Click here to Skip to main content
11,410,129 members (61,822 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: regular-expression
Hi,

I've a system which validates a string (a mail subject line) based on a regular expression pattern.

I provide - Input string and Pattern and it validates yes or no.

I've NO ACCESS to code which does that (or worse, I don't even know what it's coded upon). Just the Regular Expression pattern!

Case 1:
Input: FW: 12334-123-412 my-name test mail
Pattern: \bmy-name\b
Validation: Successful

Case 2:
Input: FW: 12334-123-412 my-name test mail
Pattern: \bMy-name\b
Validation: Failed

I need to make it case insensitive, hence I tried the pattern (?i)(\bmy-name\b)
Input: FW: 12334-123-412 my-name test mail
Pattern: (?i)(\bMy-name\b)
Validation: Failed

Can you help me with the proper pattern, having no knowledge of the comparison code?
or give me a set of possible patterns that I might use to test out?
Posted 1-Feb-12 21:34pm
Edited 1-Feb-12 21:35pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Jyothikarthik_N at 2-Feb-12 3:48am
   
/regexp/i -did not work
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Brute force?

\b[Mm][Yy]-[Nn][Aa][Mm][Ee]\b

Andi
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 229
1 OriginalGriff 140
2 Maciej Los 138
3 Sascha Lefévre 120
4 BillWoodruff 60
0 Sergey Alexandrovich Kryukov 8,771
1 OriginalGriff 6,905
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100