[program-l] Re: Regular Expression Question

  • From: "RicksPlace" <ofbgmail@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Sat, 6 Oct 2012 14:05:55 -0400

Hi Travis:
I created 2 textboxes and enter the expression in one and the test string in 
the other.
Not having much luck so far.
This should work from my megar understanding but fails:
^[A-Z][A-Z]*/.?
Test string:
MSFT.
This fails.
Do you see anything?
Rick USA
  ----- Original Message ----- 
  From: Travis Roth 
  To: program-l@xxxxxxxxxxxxx 
  Sent: Saturday, October 06, 2012 1:46 PM
  Subject: [program-l] Re: Regular Expression Question


  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: