Page 1 of 1

list of words

Posted: Mon Jul 11, 2011 6:54 pm
by bluesstruggler
Hi,
I am new here and would like to know if Regular expressions
can search a .txt document for a list of tags such as seen below.
I do not want to replace the tags I only want to know if they are present in the document?

Thanks in advance for any help, Blues

NDS13UU000A_WWA80
NDS13UU000A_WWA82
NDS13UU000A_WWA83
NDS13UU000A_WWA84
NDS13UU000A_WWA85
NDS13UU000A_WWA92
NDS13UU000A_WWA93
NDS13UU000A_WWA94
NDS13UU000A_WWA95

Re: list of words

Posted: Mon Jul 11, 2011 8:04 pm
by DV
You can use or (|)

eg NDS13UU000A_WWA80|NDS13UU000A_WWA82|NDS13UU000A_WWA83

etc

Or if you want to search a certain range you could use something like -

NDS13UU000A_WWA[8-9][0-9]

Re: list of words, what words?

Posted: Mon Jul 11, 2011 11:17 pm
by Fool4UAnyway
Regular expressions is all about "describing what you are looking for" instead of "typing what you are looking for" as absolute text matches.

In your case, the description could be something like "all words starting with ....." with an "absolute" (typed) text at the dots (NDS13UU000A_WWA) and then "ending with a two digit number", which part could be translated to the regular expression \d\d which simply says: a digit and a digit.

If you can break down your "original list of (possible) items" in simple descriptions, it will not be very difficult to translate each partial description into a regular expression.

See http://www.regular-expressions.info/ for much more information.