1 votes

Alternative to regex101 that accepts unicode mode

I was subsequently told about unicode mode in JavaScript so I looked for an article willing to try it on the site. regex101 but when testing one of the simple cases based on this site I find that it does not recognize \p{Alphabetic} and I get the error.

to the blocks \p {something} are known as " Unicode property escapes "(I don't know how they are called in English), but it seems that regex101 can't stand them.

\p This token has no special meaning and has thus been rendered erroneous

error en regex101.com

At the moment I tried to test my regular expression in the browser console and it works very well there.

console.log(/^x\p{Alphabetic}{2}$/u.test("x!!"))
console.log(/^x\p{Alphabetic}{2}$/u.test("xas"))

Is there an alternative to regex101 that allows me to test regular expressions with unicode block symbols?

0 votes

On the regex101 site you can use some of the following blocks \p{} if you mark golang as a language instead of javascript. Nevertheless \p{Alphabet} still does not admit it, although it does admit \p{Greek} o \p{Latin} for example. It looks like you can select alphabets, but not categories.

2voto

Julio Points 2278

You have a few options, but first I want to make an important point.

What you are trying to use are 'RegExp Unicode Property Escapes', which are part of the ECMAScript 2018 standard.

Currently, only Chrome/Chromium supports ECMAScript 2018 in its entirety.

Here you can see a comparative table

http://kangax.github.io/compat-table/es2016plus/

So, it is not only a matter of looking for a utility that allows Unicode Property Scapes, but also the browser where you are running the page must also support them.

Under these two conditions I have found: http://scriptular.com/ (it will work in Chrome, but not in firefox, IE, Edge,... because of the above).

Note that the ECMAScript 2018 standard is relatively new and it may take some time before it is fully supported by the vast majority of browsers. So it may be a good idea not to use these features until they are well supported by the vast majority of browsers.

However, there are also 'workarounds'. There is the javascript library " XRegExp "which extends the support of regular expressions.

And also the following page https://www.freeformatter.com/regex-tester.html which will allow you to test regular expressions "XRegExp" (if you test on this last page, note that the tested regular expressions may not work in your developments unless you use XregExp in them)

0 votes

Scriptular works 100 percent, freeformatter doesn't, despite the library :/

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X