View Single Post
Old 04-15-2015, 12:29 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,448
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by LadyKate View Post
For instance. How do I use regex to search for AA Name? If I use [A-Z][A-Z] [A-Z]. which I expect to match to AA Name it matches "Orbit Various Authors" and "Various Author" as well as the expected "AA Name".
Use
Code:
^[A-Z][A-Z] [A-Z]
As you wrote it, the expression would find any name that has any two characters at the end of a word, then a space, then a character. Adding the leading anchor (^) tells it that it must match two characters at the beginning of the name, then a space, then a character.

Note that the meaning of ^ is different when used inside [ ] characters. In that context it means "invert the set". For example, [^AB] means everything except A and B.
chaley is offline   Reply With Quote