Because LC can't do two things at once.

Peter Haworth pete at lcsql.com
Sun Feb 22 13:26:11 EST 2015


Hi Peter,
The text you referred to describes the Javascript version of regex whereas
Livecode uses the PCRE library. You can search for unicode characters in a
regex using the \p, \P, or \X character classes, but the library has to be
compiled to include the PCRE regex unicode libraries (I think) for those to
be usable.  So there's still a question for Edinburgh.

\p and \P search for unicode property classes.  For example \p{Lu} would
search for an uppercase letter  and \P{Lu} for anything other than an
uppercase letter.  There's a whole slew of character properties you can
search for.  That's not too bad but to search for a sequence of specific
Unicode characters you'd have to use \X and know the hex values of the
characters you're looking for and that certainly would be ugly!.

 I don't know enough about LC7 to figure out how complicated a Livecode
script would be to do the equivalent of \p, \P, and \X.  Hopefully someone
will chime in with an example.

On Sun Feb 22 2015 at 9:35:57 AM Peter M. Brigham <pmbrig at gmail.com> wrote:

> Buried in that list (see below) is an item noting that even the JavaScript
> version of regex lacks Unicode support. Does this mean that the LC version
> of regex will soon no longer work? Is this being addressed in Edinburgh? Or
> am I misinterpreting the situation?
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> On Feb 22, 2015, at 11:53 AM, Michael Doub wrote:
>
> > Thanks for pointing that out Kay.   I was curious to understand the
> differences and I found the following which might be of interest to folks.
> I cut it from http://www.regular-expressions.info/javascript.html .  As a
> casual regex user I have never had a problem, but your point is still very
> valid.
> >
> > -= Mike
> >
> > -------------
> >
> > JavaScript supports the following modifiers, a subset of those supported
> by Perl:
> >
> > /g enables "global" matching. When using the replace() method, specify
> this modifier to replace all matches, rather than only the first one.
> > /i makes the regex match case insensitive.
> > /m enables "multi-line mode". In this mode, the caret and dollar match
> before and after newlines in the subject string.
> > You can combine multiple modifiers by stringing them together as in
> /regex/gim. Notably absent is an option to make the dot match line break
> characters.
> >
> > Since forward slashes delimit the regular expression, any forward
> slashes that appear in the regex need to be escaped. E.g. the regex 1/2 is
> written as /1\/2/ in JavaScript.
> >
> > There is indeed no /s modifier to make the dot match all characters,
> including line breaks. To match absolutely any character, you can use
> character class that contains a shorthand class and its negated version,
> such as [\s\S].
> >
> > JavaScript implements Perl-style regular expressions. However, it lacks
> quite a number of advanced features available in Perl and other modern
> regular expression flavors:
> >
> > No \A or \Z anchors to match the start or end of the string. Use a caret
> or dollar instead.
> > Lookbehind is not supported at all. Lookahead is fully supported.
> > No atomic grouping or possessive quantifiers.
> > No Unicode support, except for matching single characters with \uFFFF.
> > No named capturing groups. Use numbered capturing groups instead.
> > No mode modifiers to set matching options within the regular expression.
> > No conditionals.
> > No regular expression comments. Describe your regular expression with
> JavaScript // comments instead, outside the regular expression string.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list