REGEX to find space followed by number 1 then letter
-
Hi Been playing around but cant figure this out, I 'm looking for a way to identify where there is a space followed by the number 1 and a letter of the alphabet, below is an example of the text and I have underlined where I want the identification to be (so I can then replace/split at that point only) but can't seem to figure it out
-ABC046Y 1SMITH/FREDMR
.L/JCD5CQ
.R/TKNE HK1 6002300348396/1-SMITH/FREDMR
.R/SEAT HK1 9F
.R/FQTV AB 60042576-1SMITH/FREDMR 1DOE/JANEMISS
.L/JC93QW
.R/TKNE HK1 6002300219029/2-1DOE/JANEEMISS
.R/SEAT HK1 8A
.R/CHKD HK1 011-1DOE/JANEMISS 1PRESLEY/ELVISMR-A2Tried a few things with regex editor but it always finds other things as well which I don't want Hope someone can help Many thanks
-
Hi Been playing around but cant figure this out, I 'm looking for a way to identify where there is a space followed by the number 1 and a letter of the alphabet, below is an example of the text and I have underlined where I want the identification to be (so I can then replace/split at that point only) but can't seem to figure it out
-ABC046Y 1SMITH/FREDMR
.L/JCD5CQ
.R/TKNE HK1 6002300348396/1-SMITH/FREDMR
.R/SEAT HK1 9F
.R/FQTV AB 60042576-1SMITH/FREDMR 1DOE/JANEMISS
.L/JC93QW
.R/TKNE HK1 6002300219029/2-1DOE/JANEEMISS
.R/SEAT HK1 8A
.R/CHKD HK1 011-1DOE/JANEMISS 1PRESLEY/ELVISMR-A2Tried a few things with regex editor but it always finds other things as well which I don't want Hope someone can help Many thanks
Try either
"\s1[A-Za-z]"
if the "space" could be any whitespace character, or" 1[A-Za-z]"
if it has to be a literal space character. Demo[^] If you want to get fancy, and match each1
which is preceded by a space and followed by a letter, without capturing the space and the letter, then you'll need zero-width assertions. Eg:"(?<=\s)1(?=[A-Za-z])"
Demo[^] If that still doesn't work, you'll need to specify which regex "flavour" you're using - PHP, JavaScript, .NET, etc. - and provide more precise details of what you have tried and what the problem is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Try either
"\s1[A-Za-z]"
if the "space" could be any whitespace character, or" 1[A-Za-z]"
if it has to be a literal space character. Demo[^] If you want to get fancy, and match each1
which is preceded by a space and followed by a letter, without capturing the space and the letter, then you'll need zero-width assertions. Eg:"(?<=\s)1(?=[A-Za-z])"
Demo[^] If that still doesn't work, you'll need to specify which regex "flavour" you're using - PHP, JavaScript, .NET, etc. - and provide more precise details of what you have tried and what the problem is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer