cjex / regulex Goto Github PK
View Code? Open in Web Editor NEW:construction: Regular Expression Excited!
Home Page: https://jex.im/regulex/
License: MIT License
:construction: Regular Expression Excited!
Home Page: https://jex.im/regulex/
License: MIT License
From the documentation for the JavaScript regular expressions there is a null representation with the \0 character however, the parser recognises this as a 0 which is not correct.
Any chance of solving this?
amd-define must be removed from the lib
Hey, nice tool, I might use that to help others understand regexp better ;)
However, it seems your script doesn't handle named capture groups :
Python's (?P<name1>xxx)
to be refered as (?P=name1)
or Perl's (?<name1>)
=> \k<name1>
Might be fun to add to your parser...
在方括号中的^符号,在可视化工具中没有效果。
Author Can you live? The world needs you
Support /\u{12345}/u
.
Hi, Superb Work. 👍
Can you Please add an option to add flags too.
Thanks.
您好:
我直接执行 node test.js
代码:
var parse = require('regulex').parse;
var re = /var\s+([a-zA-Z_]\w*);/ ;
console.log(parse(re.source));
但是报错 window is not defined,请问这个程序只能通过浏览器使用么?
报错详情:
/home/song/Desktop/regulex-master/dest/regulex.js:63
var r=[l()],n=t.num;return{accepts:r,trans:[{from:e,to:r,charset:!1,assert:function(t,e,r,i,a){var s=u(t,n,a);return void 0===s&&(s=""),a.slice(r,r+s.length)===s&&s.length}}]}}function o(t,e){var r=[],n=[];return t.branches.forEach(function(t){var i=c(t,e);r=r.concat(i.trans),n=n.concat(i.accepts)}),{trans:r,accepts:n}}function h(t,e){function n(t,e,r){var n=[l()];return{accepts:n,trans:[{from:e,to:n,charset:!1,assert:r}]}}function i(t){var e=r(c(t.sub,["start"]));return function(t,r,n,i,a){var s=e.input(a,n,null,t);return s.acceptable}}function a(t){var e=i(t);return function(){return!e.apply(this,arguments)}}function s(t,e){return!!(o(t-1,e)^o(t,e))}function o(t,e){return t!==-1&&t!==e.length&&/\w/.test(e[t])}function h(t,e,r,n,i){return 0===r||"\n"===i[r-1]}function u(t,e,r,n,i){return 0===r}function f(t,e,r,n,i){return r===i.length||"\n"===e}function p(t,e,r,n,i){return r===i.length}var d;switch(t.assertionType){case AssertBegin:d=t.multiline?h:u;brea
ReferenceError: window is not defined
at Object. (/home/song/Desktop/regulex-master/dest/regulex.js:63:14889)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/song/Desktop/regulex-master/dest/test.js:1:95)
at Module._compile (module.js:570:32)
fixed
Positive lookbehind: (?<=Y)X
, matches X
, but only if there’s Y
before it.
Negative lookbehind: (?<!Y)X
, matches X
, but only if there’s no Y
before it.
For example: /a++/
Regulex only conforms with ECMAScript's regex syntax.
Regulex works perfect for Regex not long enough, you can easily visualize the generated .svg against the expression. However, when it comes to fairly LARGE REGEXes, it becomes really hard to drag/scroll the webpage. Is there any way to integrate a collapsible option to collapse the regions of the AST if possible?
regexp: /[ -~]/
is a set what is from space key to wave key, but visual result is wave key and split key set wrongly.
Miss types in TypeScript project, hope to add.
Thank you very much for this excellent tool!
I love using it, it really helps
I saw I can't use the negative look behind syntax ?<!
Can you please add support for that?
Example -
find all strings 'py' that are not prefixed by 'co'
/(?<!co)py/
Thanks
(?<=\d{6})\d{10}(?=.{2})
Was presented with an unexpected char error when trying to make your awesome tool choke on this regexp pattern which I myself am not responsible for having written but nonetheless does still validly work (as a java.util.regex pattern):
(\w*?)(\s+|^)(NORTHEAST |NORTHWEST |SOUTHEAST |SOUTHWEST |NORTH |SOUTH |EAST |WEST |NE |NW |SE |SW |N |E |S |W |)\s*?((COUNTY |CNTY |CTY |STATE |ST |US |UNITED STATES |TOWNSHIP |TS |TWP |OLD |RANCH |INTERSTATE |)\s*?((?<=(?:COUNTY |STATE |ST |RANCH |CNTY |CTY |TOWNSHIP |TS |TWP |OLD |))ROAD|(?<=(?:COUNTY |STATE |ST |RANCH |CNTY |CTY |TOWNSHIP |TS |TWP |OLD ))RD|(?<= )HIGHWAY|(?<= )HIWAY|(?<= )HWY|(?<= )EXPRESSWAY|(?<!^STAR |^TRACY|^)ROUTE|(?<!(?:^STAR |^TRACY|^))RTE|rte|(?<!(?:^STAR |^TRACY|^))RT(?= )|(?<= )CR(?= )|(?<= )VIA(?= )|(?<= )INTERSTATE(?= )|(?<= )LOOP|(?<= )I(?=-\d+)|(?<= )I(?= \d+)|(?<= )I(?=\d+)))($|[-\s]*(\w?\w*)( NORTHEAST(?=$| )| NORTHWEST(?=$| )| SOUTHEAST(?=$| )| SOUTHWEST(?=$| )| NORTH(?=$| )| SOUTH(?=$| )| EAST(?=$| )| WEST(?=$| )| NE(?=$| )| NW(?=$| )| SE(?=$| )| SW(?=$| )| N(?=$| )| E(?=$| )| S(?=$| )| W(?=$| )|)\s*(.*?))
It would be great if you could support named capture groups e.g. (?.*)
Even if initially you just did a search replace removing them, it would make it much easier to copy and paste a regex in to visualize as I just manually removed 10 from a regex I copied in to check out your tool.
Long term, it would be great to add them to the visualization as a label, but I can respect that its more work and I'm asking for something without giving anything back.
Hi linpolly .
I got problems to download ing video and getting error . Remember ? Last
Time you have fixed and said me once it update again you will help .
Can i know how i can fix to download latest youtube video.
And you remember last time you have fixed?
regex like this: (?<=abc>[\s\S]*?(?=def)
Tried installing via npm i regulex
but apparently this package is not published to the registry. When examples mention require('regulex')
, it kind of confuses when package is not found and you need to clone and build it manually.
Hey, Thanks for writing this visualiser, I enjoyed playing with it 👍
However I noticed an issue where nested capture groups cause backrefs to be marked as recursive when they aren't.
In the screenshot, the diagram shows the outer capture group as \1 and the inner group as \2. This is consistent with grep. However when I add \2 inside group 1, but not inside group 2, the backref is marked as recursive.
I want to display the regex graphically, but that comes from our python backend.
Currently the parser chokes on syntax like (?P
How do I change so that group is recognized with (?P and name <>) ?
thanks for your help.
Requiring a user to hit "Visualize" is cumbersome - why not update the visualization whenever the regex is changed?
the visualisation should be in real time zhen typing
The flag option is removed when clicked through a url. E.g.
https://jex.im/regulex/#!flags=g&re=%23(%5B0-9A-F%5D%7B3%7D%7C%5B0-9A-F%5D%7B6%7D)
The /g option is removed when the page loads.
A little nice feature would be to detect when the user paste something in the input field and if it looks like a regex, automagically remove the regex delimiter, and extract optional flags.
To understand what I mean, try to paste this whole regex /^https?:\/\//ig
into regex101 website https://regex101.com/.
Also, when a regex is pasted, it should automatically update the image.
What do you think ?
Could you compile all source files into single (or maybe two: one parse and second into visualize) bundle, please? Then I can include your regulex visualizer into my d3-panel https://github.com/bahmutov/d3-panel and that would be very useful
I think this expression - http://jex.im/regulex/#!embed=false&flags=&re=%5Ea%7Cb%24
and this expression - http://jex.im/regulex/#!embed=false&flags=&re=%5E(a%7Cb)%24
should look the same, except of 'group' block
Hi! This is great project, can you add export into png/svg?
I've tried to build visualisation for this regexp http://ex-parrot.com/~pdw/Mail-RFC822-Address.html, but it's to big.
Give a tip for ([a-z]){3}
,Repeat after capture group, only the last appearance will be captured. For example: /([a-z]){3}/.exec("abc")
will result ["abc","c"]
/a(?=bc){3}/
、/a(?=bc)+/
should warn "They are the same as /a(?=bc)/
"
/a(?=bc)*/
、 /a(?=bc){0,3}/
、 /a(?=bc)?/
should warn "They are the same as /a/
"
I write a regular expression,I would download the corresponding visual image, but I can't do it.
Error:
Mixed Content: The page at 'https://jex.im/regulex/#!embed=false&flags=&re=%5E%23-%3F%5B1-9%5D%2B%5B0-9%5D*%3A-%3F(%5B0-9%5D%7C%5B1-9%5D%2B%5B0-9%5D*)%24' was loaded over HTTPS, but requested an insecure script 'http://libs.useso.com/js/require.js/2.1.11/require.min.js'. This request has been blocked; the content must be served over HTTPS.
require.min.js download failed
XRegExp augments JavaScript regex syntax with additional features like named capture, the x
flag for free spacing and line comments, and \p{..}
for Unicode properties. It would be awesome if Regulex supported these features as well. Apart from XRegExp, they're supported in a variety other modern regex implementations (Java, Perl, PCRE, .NET, etc.).
Support for naming capture groups would be nice.
i.e. / (?<Date>\d{4}-\d{2}-\d{2}) /
could be displayed as Group #1: Date
It might be an interesting idea to use this library to parse regex into a directed graph (perhaps using https://github.com/dagrejs/graphlib), and let other preexisting renderers produce the graphic (on the case of graphlib, https://github.com/dagrejs/dagre-d3 or https://github.com/dagrejs/dagre)
vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in callback for watcher "formInfo.reg_param": "Error: define cannot be used indirect"
Vue下面会报出如上错误,怎么使用
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.