Exclude a word

dec_obrien

New member
Joined
Feb 14, 2005
Messages
3
Location
Dublin, Ireland
Hi,
I want a Regular Expression to allow anything except a particular word i.e. "select". How do I do this? Ive tried excluding each letter individually ^[^s][^e][^l][^e][^c][^t]$ but this doesnt work if a letter happens to match e.g. "string" (the first s matches)
Thanks in advance.
 
I know what you mean

dec_obrien said:
Hi,
I want a Regular Expression to allow anything except a particular word i.e. "select". How do I do this? Ive tried excluding each letter individually ^[^s][^e][^l][^e][^c][^t]$ but this doesnt work if a letter happens to match e.g. "string" (the first s matches)
Thanks in advance.

Ive had this issue before and its might near impossible to do. One thing you can do is find lines that contain "select" and exclude them from processing. For example, if you were reading a file or stream that is broken into separate lines you could test each line to see if it contains "select" and only process the ones that fail the test. Maybe this helps. :-\
 
Possible solution for your dropdown list

dec_obrien said:
How do I exclude a line? Basically what Im doing is checking that a value has been selected from a dropdown list.
Thanks in advance.

Well...I imagine youve got a drop down list thats populated with the word "Select a dog breed" or something like that at the top to direct users what to do.

If that is the case, and you know what the directive message is, i.e. "Select a dog breed", then in the dropdown_changed event handler for that control I would just check for the directive message and do nothing if the "Select a dog breed" message is the text value.

Does this make sense?

Another alternative is to have the control label direct the user what to do, and have an empty entry as the top choice in the drop down list. You could then just check for non-emptiness in the event handler. :)
 

Similar threads

Back
Top