Page 1 of 1

Search Criteria

Posted: Sat Sep 07, 2013 7:02 pm
by dbrannick
When searching for text within a file, a name may be stored with a dash (-) or underscore (_) I.e. a-b-c or a_b_c
Is there a way I can specify a search criteria to always look for either or. Or how would I specify the search if I entered it on the search text line?
thanks.

Re: Search Criteria

Posted: Sun Sep 08, 2013 2:15 am
by FileViewer
When searching for text within a file, a name may be stored with a dash (-) or underscore (_) I.e. a-b-c or a_b_c
Is there a way I can specify a search criteria to always look for either or.
You need to use regular expressions to do this.

For example, if you wanted to find a-b or a_b, you would search for "a[-_]b" (without the quotes) and enable the Regular Expression (Regex) option.

If you wanted to find a-b-c or a_b_c you could search for "a[-_]b[-_]c". Note that this would also find a-b_c which you may not want, but there are ways of overcoming this.

Regular expressions are very powerful but can also be very confusing. If you are interested in doing more advanced searches, take a look at the Regular Expressions documentation in the help file.

Re: Search Criteria

Posted: Thu Sep 12, 2013 2:29 pm
by dbrannick
I tried the regular express you indicated and I'm getting a message stating 'nothing to repeat'. I selected regular expressions. Did I do something wrong?
thanks.

Re: Search Criteria

Posted: Thu Sep 12, 2013 3:37 pm
by FileViewer
I tried the regular express you indicated and I'm getting a message stating 'nothing to repeat'.
That indicates the regular expression you entered was invalid.

What *exactly* did you enter as the regular expression?

Use Google to search for regular expression tester. These sites can test regular expressions to see if they are valid.

Re: Search Criteria

Posted: Thu Sep 19, 2013 1:12 pm
by dbrannick
A follow up. I've created a regex expression similar to your example. Used the regex tester and it worked except I had to put a ^ in front of the expression. However when I tried it again in the search box I got the same error.

Re: Search Criteria

Posted: Thu Sep 19, 2013 3:32 pm
by FileViewer
I've created a regex expression similar to your example
I need to know the exact regex that is giving the error message.