Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Reg Expressions. Match A Full Stop?

This is a discussion on Reg Expressions. Match A Full Stop?, within the Javascript section. This forum and the thread "Reg Expressions. Match A Full Stop?" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Reg Expressions. Match A Full Stop?
Jason
post May 29 2008, 06:04 AM
Post #1


Master of the Universe
******

Group: Mentor
Posts: 1,069
Joined: 15-February 08
From: London, England
Member No.: 141



I am trying to cut out commas and full stops from numbers. I checking against ParseInt to see if the number is valid. If it is I am trying to check for commas and periods. Commas are not a problem.

However The full stop is a proving rather hard to pin down.

Why isn't this working?

PriceStr.match('/\./')


EDIT: Solved by using 'lastIndexOf' instead. Am still interested to find out how to match a full stop though.


--------------------
Go to the top of the page
 
+Quote Post
Rakuli
post May 29 2008, 06:21 AM
Post #2


Squeeze Machine
*****

Group: Team Leaders
Posts: 551
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



In Javascript you don't put quotes around your regex patterns.

PriceStr.match(/\./); is what you need


--------------------
Bright Idea? -- Don't Let it disappear
Go to the top of the page
 
+Quote Post
Jason
post May 29 2008, 06:34 AM
Post #3


Master of the Universe
******

Group: Mentor
Posts: 1,069
Joined: 15-February 08
From: London, England
Member No.: 141



QUOTE (Rakuli @ May 29 2008, 12:21 PM) *
In Javascript you don't put quotes around your regex patterns.

PriceStr.match(/\./); is what you need


ohmy.gif I spent 30 minutes doing every variation of "/\./" imaginable... I had it right the whole the time... Grrr. Thanks for the info smile.gif


--------------------
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   4 Simon 150 14th February 2008 - 11:01 AM
Last post by: Simon
No New Posts   4 Jason 118 15th February 2008 - 01:40 PM
Last post by: rewake
No New Posts   0 thesealportalteam 95 29th February 2008 - 09:40 AM
Last post by: thesealportalteam
No New Posts   2 902 93 18th March 2008 - 11:00 PM
Last post by: Rakuli
No New Posts   0 katrinasuzanne 145 12th August 2008 - 06:37 AM
Last post by: katrinasuzanne