Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

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
0
SLoBoil
Asked:
SLoBoil
  • 6
  • 4
  • 2
  • +1
1 Solution
 
ddrudikCommented:
match on ^\D*
trim the ending whitespace that is returned if desired.
0
 
ahoffmannCommented:
^(\D*)
0
 
SLoBoilAuthor Commented:
Neither of those work :(
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
ozoCommented:
How did you use them?
0
 
ahoffmannCommented:
which regex flavour are you using, please post your example also
0
 
SLoBoilAuthor Commented:
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
 
ddrudikCommented:
the following would return Reference: and any non-numerics.
Reference: [^0-9]*

Open in new window

0
 
ddrudikCommented:
Where in QuickFields are you using this regular expression?
0
 
SLoBoilAuthor Commented:
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
 
ddrudikCommented:
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
 
ddrudikCommented:
If you want to allow spaces as well:
[^ a-zA-Z0-9.,:-]
0
 
SLoBoilAuthor Commented:
Doesn't the  ^   say not any of those characters ?
0
 
ddrudikCommented:
Sorry, leave out the ^:

Reference: [ a-zA-Z.,:-]*
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now