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.
Search Criteria
Moderator: vuser
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Search Criteria
You need to use regular expressions to do this.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.
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
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.
thanks.
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Search Criteria
That indicates the regular expression you entered was invalid.I tried the regular express you indicated and I'm getting a message stating 'nothing to repeat'.
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
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.
-
- Site Admin
- Posts: 287
- Joined: Fri Apr 30, 2010 5:50 pm
Re: Search Criteria
I need to know the exact regex that is giving the error message.I've created a regex expression similar to your example