Discussion:
need some help with javascript syntax detection
Olivier Sessink
2014-03-22 15:40:25 UTC
Permalink
Hi all,

I need some help with javascript syntax detection, especially correctly
working with regex syntax. The current regex
syntax does not work corectly, see:
https://bugzilla.gnome.org/show_bug.cgi?id=726849

What different kinds of regex syntax is allowed in javascript? As far as
I understand there are two possible types:

either the regex pattern starts with a " or a ' and we should treat is
as a regular string

or it starts with a / and then we should treat it as a string up to the
next slash and also the following modifier characters that may be g or i.

but the current javascript syntax has some special code if a ( is found.
why is that there? So perhaps there are more types of syntax?

Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
Lindsay Haisley
2014-03-22 17:30:47 UTC
Permalink
http://www.w3schools.com/jsref/jsref_obj_regexp.asp may be helpful

http://www.regular-expressions.info/javascript.html discusses the
difference between RegExp syntax in JavaScript and that in perl, of
which it's a subset.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions looks pretty good, and discusses the use of parentheses as backreference definitions in JavaScript regular expressions.
Post by Olivier Sessink
Hi all,
I need some help with javascript syntax detection, especially correctly
working with regex syntax. The current regex
https://bugzilla.gnome.org/show_bug.cgi?id=726849
What different kinds of regex syntax is allowed in javascript? As far as
either the regex pattern starts with a " or a ' and we should treat is
as a regular string
or it starts with a / and then we should treat it as a string up to the
next slash and also the following modifier characters that may be g or i.
but the current javascript syntax has some special code if a ( is found.
why is that there? So perhaps there are more types of syntax?
Olivier
--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/
--
Lindsay Haisley | "Everything works if you let it"
FMP Computer Services |
512-259-1190 | --- The Roadie
http://www.fmp.com |
Continue reading on narkive:
Loading...