Home: Perl Programming Help: Regular Expressions:
negate a word#?#?#?#?#?



shinned
Deleted

Sep 6, 2000, 1:21 AM


Views: 7590
negate a word#?#?#?#?#?

Help badly needed.

How do we negate a word?

shinned


japhy
Enthusiast / Moderator

Sep 6, 2000, 3:41 AM


Views: 7590
Re: negate a word#?#?#?#?#?

Could you give an example of what you mean, maybe? Do you mean "how do I specifically NOT match a word?" I have no idea what you mean. Please explain.

------------------
Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher



shinned
Deleted

Sep 6, 2000, 4:13 AM


Views: 7590
Re: negate a word#?#?#?#?#?

 
Ex.

Text is :

<emp type="bold">text here. ( could be a multi-line</emp>

RE is :

/<emp [^<>]*>(.*)</emp>/

now how do I know that .* does not contain any <emp> or </emp> tag? Whis this I want to negate the word/text "<emp>" or "</emp>", How do I do that?


Thanks in advance.

shinned


dws
Deleted

Sep 7, 2000, 10:23 AM


Views: 7590
Re: negate a word#?#?#?#?#?

/<emp [^<>]*>(.*?)<\/emp>/

.* matches as many characters as possible
.*? matches as few characters as possible