Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expressions

Status
Not open for further replies.

mlowe9

Programmer
Apr 3, 2002
221
US
Background: I am using MATCH with the Match:Regular flag to use a regular expression to match a pattern.

How do I write a regular expression in Clarion to match everything EXCEPT a string? For example, I have a 3-digit string that I want the MATCH to return True if it's not 'ZZZ'.

I've tried [^ZZZ] and [^Z][^Z][^Z] but neither works because the [^] is for a single character, not a group of characters. Thanks in advance.
 
Hi mlowe9,

why not simply say
szVar <> 'ZZZ'

If you must use MATCH, then try
NOT MATCH( szVar, 'ZZZ', Match:Regular)

That said, I assume you're doing something more complex, can you please elaborate.

- Mark
 
I have a procedure that takes a regular expression argument. That procedure uses MATCH then uses the argument as the pattern. Does that make sense?

I've been using it for a while, but just got a new request to do this procedure for a pattern not including a specific string.

I could modify the procedure to maybe look for a NOT in the argument, but I was hoping to just use the procedure as is and pass the regular expression - I figure there has to be a way to do it...I've used regular expressions for a while and they are pretty flexible (once you figure it out)

So you suggest just changing the procedure. I guess it probably would be easier..I've been trying to figure this stupid regular expression out all day. Thanks!
 
You could hack your procedure so that if your passed in regular expression started with a special symbol, say a '~', then you alter the logic to say NOT MATCH vs. MATCH

I know it's a hack, but it might be the cleanest solution.

HTH,
Mark
 
Yeah, based on your input I decided on using < and > to enclose any regular expression I did NOT want to match - and changing my procedure to handle it.

Thanks again.
Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top