Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need simple regex

Posted on 2009-05-18
13
Medium Priority
?
336 Views
Last Modified: 2012-05-07
I need a regular expression that basically stops when it encounters a numeric in the string.
For Example:

String: CB RICHARD ELLIS 12/06
RegEx should return: CB RICHARD ELLIS

String: Maritime Telecoms 2ND Lien 5/06
RegEx should return: Maritime Telecoms
0
Comment
Question by:SLoBoil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 27

Expert Comment

by:ddrudik
ID: 24413849
match on ^\D*
trim the ending whitespace that is returned if desired.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 24414273
^(\D*)
0
 

Author Comment

by:SLoBoil
ID: 24414509
Neither of those work :(
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 84

Expert Comment

by:ozo
ID: 24414645
How did you use them?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 24414699
which regex flavour are you using, please post your example also
0
 

Author Comment

by:SLoBoil
ID: 24415118
I'm actually using an optical scanning tool called Quick Fields. It is part of the Laserfiche product.

Basically I am scanning a tif image that has a text line like either of the following:

Sample1:
   Reference: MARITIME TELECOMMS 2ND LIEN 5/06

Sample2:
  Reference: CB RICHARD ELLIS 12/06

For Sample1 I need a regEx that returns just  MARITIME TELECOMMS

For Sample2  I need a regEx that returns just  CB RICHARD ELLIS

I current have this:
  (Reference[:,]\b+{(\a+\b?)*}[$1234567890+(]?)
and it returns CB RICHARD ELLIS 12

so i am close.
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 24415140
the following would return Reference: and any non-numerics.
Reference: [^0-9]*

Open in new window

0
 
LVL 27

Expert Comment

by:ddrudik
ID: 24415180
Where in QuickFields are you using this regular expression?
0
 

Author Comment

by:SLoBoil
ID: 24415381
Thanks  ddrudik, the following is very close  
        Reference: [^0-9]*

Is there something I could add to it that would also ignore special characters (windows characters that is)

0
 
LVL 27

Expert Comment

by:ddrudik
ID: 24415398
You could just define the set of characters you want to allow and include them in the [^...] block in the pattern such as:
[^a-zA-Z0-9.,:-]
0
 
LVL 27

Expert Comment

by:ddrudik
ID: 24415404
If you want to allow spaces as well:
[^ a-zA-Z0-9.,:-]
0
 

Author Comment

by:SLoBoil
ID: 24415572
Doesn't the  ^   say not any of those characters ?
0
 
LVL 27

Accepted Solution

by:
ddrudik earned 150 total points
ID: 24415582
Sorry, leave out the ^:

Reference: [ a-zA-Z.,:-]*
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been reconstructing a PHP-based application that has grown into a full blown interface system over the last ten years by a developer that has now gone into business for himself building websites. I am not incredibly fond of writing PHP code o…
Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question