[program-l] Re: Regular Expression Question

  • From: "RicksPlace" <ofbgmail@xxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Sun, 7 Oct 2012 10:38:46 -0400

Thanks Travis, I'll give it a try likely tomorrow.
Rick USA
  ----- Original Message ----- 
  From: Travis Roth 
  To: program-l@xxxxxxxxxxxxx 
  Sent: Sunday, October 07, 2012 9:35 AM
  Subject: [program-l] Re: Regular Expression Question


  Hello Rick,

   

  The current expression would match more than one period because the 
expression is not ended, e.g., the $ sign is not used to say additional 
matching is not allowed.

  According to your specifications (only for upper case letters) this should 
work.

  ^[A-Z][A-Z]*[\-\.]?[A-Z]*$

   

  From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] 
On Behalf Of RicksPlace
  Sent: Sunday, October 07, 2012 3:43 AM
  To: program-l@xxxxxxxxxxxxx
  Subject: [program-l] Re: Regular Expression Question

   

  Hi Travis:

  The slash was a mistake since this is a .net app.

  What I am trying to do:

  Ensure the first character is a letter (Case should not matter or I can 
enforce upper case as i did in my test expression)

  There may be no special characters in a ticker symbol like:

  MSFT or KMI or PPG

  Or there may be one period in a ticker symbol like:

  MSFT.OB or PPG.XYZ

  There can not be more than one period if there are any in the ticker.

  This would be invalid MS.FT.OB as there are 2 periods as would be MS..FT or 
MSFT.. two periods are not allowed only 0 or 1.

  Finally there can be 0 to 1 dashes like:

  MSFT-BB or even MSFT-BB.OB.

  Again MS-FT-OB would be bad because of 2 dashes in the string.

  No other characters are allowed in the string only letters, perhaps one 
period and, or, perhaps one dash.

  I couldnt get the filters to work yesterday so just checked the first 
character to ensure it was a letter - that worked.

  I think the [A-Z] also works but the \. allowed more than one period like:

  MS..FT or MSFT..OB

  Rick USA

     

       

Other related posts: