[program-l] Re: Regular Expression Question

  • From: "Travis Roth" <travis@xxxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Sat, 6 Oct 2012 12:46:44 -0500

Yes asterisk is used for any number of letters.

 

I believe you will need to escape the period and hyphen as they both have
other meanings in regex as well.

If it can be either/or you would want  them inside of brackets also.

 

It may be helpful to find a regex simulator or write something up quick you
can just run to see what it does like make an app that pops up a message box
of the results of your match, then edit and quick rerun it until you get
what you want.

 

From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx]
On Behalf Of RicksPlace
Sent: Saturday, October 06, 2012 12:08 PM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Regular Expression Question

 

Hi: I want to edit a ticker symbol in a string all caps.

First position must be letter 

Followed by more cap letters, perhaps a dash or period then at least one
more letter.

I have this as a starter does it look even remotely correct?

^[A-Z][A-Z]/-?/.?[A-Z]

Should there be a star in the second factor to indicate there can be any
number of capital letters after the first?

Now I am remembering why I didnt use them a few years ago but I hope I can
learn this time

Thanks Rick USA

Other related posts: