I need a regular expression for a phone number.
Example,
1234567899 should be (123)(456)(7899)
12345678 should be (123)(456)(78)
1234567 should be (123)(456)(7)
123456 should be (123)(456)
12345 should be (123)(45)
123 should be (123)
1 should be (1)
I tried /([0-9]{0,3})([0-9]{0,3})([0-9]{0,4})/
and /([0-9]{3})([0-9]{3})([0-9]{4})/
But it takes only when all the 10 numbers are in the input.
I need match then replace with (