Search Criteria

Use this forum to ask any questions and to submit bug reports

Moderator: vuser

Post Reply
dbrannick
Posts: 22
Joined: Tue Feb 08, 2011 8:19 am

Search Criteria

Post 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.
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: Search Criteria

Post 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.
dbrannick
Posts: 22
Joined: Tue Feb 08, 2011 8:19 am

Re: Search Criteria

Post 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.
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: Search Criteria

Post 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.
dbrannick
Posts: 22
Joined: Tue Feb 08, 2011 8:19 am

Re: Search Criteria

Post 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.
FileViewer
Site Admin
Posts: 287
Joined: Fri Apr 30, 2010 5:50 pm

Re: Search Criteria

Post 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.
Post Reply