Click here to Skip to main content
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 20:34pm
Edited 1-Feb-12 20: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 OriginalGriff 364
1 Nirav Prabtani 268
2 _Amy 185
3 CHill60 170
4 Sergey Alexandrovich Kryukov 166
0 OriginalGriff 8,004
1 Sergey Alexandrovich Kryukov 7,017
2 Maciej Los 4,039
3 Peter Leow 3,738
4 CHill60 2,912


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 2 Feb 2012
Copyright © CodeProject, 1999-2014
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