View Single Post
Old 14-07-2004, 16:44   #7
Mr_love_monkey
Inactive
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 50
Services: Sarcasm
Posts: 8,376
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Mr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny starsMr_love_monkey has a pair of shiny stars
Re: Filtering out comma's with PHP

Glad to hear it's fine

Don't know if this will be of any use to you later, but this is from one of the
javascript books I've got on the pattern matching

Quote:
When you specify a regular expression, it will by default only match the first occurrence that it encounters. It is possible to specify a pattern to match that can occur several times in a line. To match all of these, you can use the 'g' attribute. The 'g' stands for global matching.

There is one other attribute that allows the matching to be carried out in a case-insensitive manner. That is the 'i' attribute.

Both of these attributes are placed after the closing slash at the end of the pattern.

The case-insensitive match works like this:

/javascript/i

would match the following strings

JavaScript

javascript

JAVASCRIPT

JaVaScRiPt

The g attribute applied like this, would cause the pattern:

/0/g

to match every zero in the string:

'0100, 00123, "00067", 666000'

There is another attribute to control whether the pattern is applied to single lines or multiple lines. Because the regular expression is realized as an object, this is controlled by means of an object property accessed via the multi-line identifier, the letter 'm' in JavaScript 1.5 (shipped with Netscape 6.0)

Here is a list of the available attributes:



g Global match for every occurrence of the pattern throughout the line.
i Case-insensitive matching.
ig Case-insensitive global match.
m Multiple lines to be processed. Available only in JavaScript 1.5 and mutually exclusive with the 's' attribute.
gm Global match on multiple lines.
im Case-insensitive matching on multiple lines.
igm Case-insensitive global match on multiple lines.
Mr_love_monkey is offline   Reply With Quote