On 18.06.09 19:14, MySQL Student wrote:
> Hi Dan,

I'm not Dan. This is a mailing list. Meny people read it and many can
respond your mail.

> > Do I need the backslashes to escape the spaces?
> >
> > no, although \s would be fine.

> Okay, so either \s or nothing at all works just the same?

the \s works like whitespace character - space, tab. replacing spaces for \s
is OK, unless you want tabs not to match.

> > this can be much more effectively written as:
> > /.spam\ssample./i
> 
> > That will match the words "spam sample" in the subject as long as there
> > is at least 1 character before and one after.
> 
> But you had previously written that /Spam Sample/ will also match that text
> anywhere on the line. Is that not the case?

/spam sample/ will match the test anywhere on line.
/.spam sample./ will match the text anywhere on line, except the begin and
the end, since it must be preceded by at least one character.
 
/(.+)spam sample(.+)/ will match exactly the same, but the match will be
slower since the (.+) will need to compare all text before/after the "spam
sample" and store them both to capture buffers.

-- 
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Quantum mechanics: The dreams stuff is made of. 

Reply via email to