Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

If Not a Match, do this

Regex question

9:46 pm on Jan 26, 2011 (gmt 0)

5+ Year Member

I was wondering if it's possible to say something like

If this string DOESN'T match this, do this...like for instance

if !($string =~ m|>.*Widget<|) {
$string =~ s|>(.*)Widg<|>$1Widget<|;

That's a rough example, but it gives you the basic idea. I tried it and of course it wasn't very happy with me and gave me an error. Can you not use a negative match like that, or must I have an ELSE to go along with it? I was under the impression an ELSE wasn't required, but the error seemed to suggest otherwise.

Software error:

Can't locate /home/deploy/webmasterworld/code_format-v6.lib in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at decode-post-v6.lib line 27, <THREADDAT> line 3.

For help, please send mail to the webmaster (it@imninjas.com), giving this error message and the time and date of the error.