I need a regex that converts +442070320811
to 2070 320811
.
Using this regex \(\d{4})(\d{6})(\d*)$
gives me 4420 703208
Can anyone advise how I can start the match after the 44?
I need a regex that converts +442070320811
to 2070 320811
.
Using this regex \(\d{4})(\d{6})(\d*)$
gives me 4420 703208
Can anyone advise how I can start the match after the 44?
Search: \+44(\d{4})(\d{6}\b)
Replace: $1 $2
or \1 \2
depending on language / environment.
JavaScript:
text.replace(/(\+44)(\d{4})/g,'$2 ');
Java:
text.replaceAll("(\\+44)(\\d{4})","$2 ")
Simply use regex grouping feature that groups pattern inside parenthesis ().
This also worked:
^.{2}((\d{4})(\d{6})(\d*)$)
Then I could refer to the sections using $2,$3 and $4