PDA

View Full Version : [SOLVED:] Find & Replace Regex - 2 Letters Conditon



dj44
09-05-2016, 05:10 PM
Hi folks,

good monday!:)

got stuck on the regex again.


#bAlvarez,
Ampère,
#bAnaximander
Archimedes
Aristarchus
#bxAristotle
Amedeo


1. to find all the words with a #b in front - \#[b][A-z]{1,} works
and would give me

#bAlvarez,
#bAnaximander
#bxAristotle



2. but if i want to find the word that only has only #bx - \#[bx][A-z]{1,} doesnt work it picks up the same as above


How can i isolate only the #bx word

cheers
dj

gmayor
09-06-2016, 12:09 AM
Search for #bx[A-z]{1,}

dj44
09-06-2016, 05:49 AM
Hello Graham,

that did the trick.

I thought you had to escape the # with the back slash as i was following other regex guidelines


cheers for this :)
dj

gmayor
09-06-2016, 06:49 AM
See http://www.gmayor.com/replace_using_wildcards.htm

Paul_Hossler
09-06-2016, 01:20 PM
I thought you had to escape the # with the back slash as i was following other regex guidelines
dj


Word does not use 'real' RegEx, but as Graham's link shows it uses Wildcards which have just enough differences to be confusing

dj44
09-07-2016, 05:54 AM
I found another trick thanks to Graham

looking for the words #zqArchimedes #zqAristotle

#[z][q][A-z]{1,}

put the z in [ ]

and the q in []

then it will only pick up exact matches of # followed by z followed by q.

:)

gmayor
09-07-2016, 10:53 PM
#zq[A-z]{1,}
would work as well.