Link to home
Start Free TrialLog in
Avatar of SLoBoil
SLoBoil

asked on

Need simple regex

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
Avatar of ddrudik
ddrudik
Flag of United States of America image

match on ^\D*
trim the ending whitespace that is returned if desired.
^(\D*)
Avatar of SLoBoil
SLoBoil

ASKER

Neither of those work :(
How did you use them?
which regex flavour are you using, please post your example also
Avatar of SLoBoil

ASKER

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.
the following would return Reference: and any non-numerics.
Reference: [^0-9]*

Open in new window

Where in QuickFields are you using this regular expression?
Avatar of SLoBoil

ASKER

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)

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.,:-]
If you want to allow spaces as well:
[^ a-zA-Z0-9.,:-]
Avatar of SLoBoil

ASKER

Doesn't the  ^   say not any of those characters ?
ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial