[thelist] Regular Expression in Javascript

Bob Haroche spambait at onpointsolutions.com
Tue Jun 17 00:08:56 CDT 2003

I wrote:

>> Might be that /< is a meta-sequence to match the start of a word
>> -- in
>> your case, a word that starts with plain old "a".

You replied:

>  I don't know what you mean by 'meta-sequence', but
> string.match(re,string) normally returns either an array of
> matches or 'null'.  When trying to match /<a>/gi it returned
> nothing at all...

A meta-sequence is simply a regexp term for a series of metacharacters
(.^$*? are examples of metacharacters). For instance, the
meta-sequence </ means "start of word" so as it's used here

</some word

it says to match a word that begins with "some", thereby excluding the
words "foursome" or "lonesome".

Your code snippet


if I understand it correct, is in effect saying "find a word that
begins with 'a' "; it' not saying "find '<a' "

Make sense? I just started with regexp myself and have found the
O'Reilly (of course) book "Mastering Regular Expressions" excellent --
first two chapters provide a lot of the understanding I need for my
regular tasks, but it goes very deep beyond that and it's surprisingly

Bob Haroche
O n P o i n t  S o l u t i o n s

More information about the thelist mailing list