|
Posted by Matthew Weier O'Phinney on 04/30/05 14:53
* Khorosh Irani <khorosh@gmail.com>:
> For example I want to math this stream:
> 123 mm 334
> What is the pattern that math with this stream?
Depends on what regexp function you use, what exactly you want to match,
and whether or not you want to know, after you match, any of the
segments. Rasmus has given you one possible pattern that works with the
ereg functions. If you wanted to use a preg function and wanted to match
3 digits, a space, two m', one or more spaces, and 3 digits, you would
use:
preg_match('/^\d{3} mm\s+\d{3}$/', $string);
But, what it all comes down to is: you need to determine what PATTERN
you need to be able to match. Once you know that, you can write the
regexp.
> On 4/29/05, Malcolm Mill <malcolm.mill@gmail.com> wrote:
> > What is it you want to do?
> >
> > On 4/29/05, Khorosh Irani <khorosh@gmail.com> wrote:
> > > Hello
> > > I have a question:
> > > What is in the role of space in the regular expressions (POSIX)?
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org
[Back to original message]
|