in reply to Re^2: pattern matching for string [SYN, ACK]
in thread pattern matching for string [SYN, ACK]

I'm still not clear on what you want.

Maybe you want:

$user_string = "[SYN, ACK]"; if ($x =~ /\Q$user_string\E/) { print("match\n"); } else { print("no match\n"); }

Maybe you want:

$user_string = "[SYN, ACK]"; if ($x =~ /(\[.*?\])/) { if ($1 eq $user_string) { print("match\n"); } else { print("no match\n"); } } else { print("not even close\n"); }

By the way, use &#91; for [ and &#93; for ] in your posts. Better yet, don't escape anything and place code and code bits within <c>...</c> tags.

Replies are listed 'Best First'.
Re^4: pattern matching for string [SYN, ACK]
by phemal (Sexton) on Sep 15, 2006 at 02:26 UTC
    hey man, the first solution seems to be working because my strings could have any pattern including the SYN, SYN, ACK etc.. Thanks a lot for for the effort and valuable time.. Hemal