Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named capture groups ? #5

Closed
gilou opened this issue Nov 26, 2014 · 5 comments
Closed

Named capture groups ? #5

gilou opened this issue Nov 26, 2014 · 5 comments
Milestone

Comments

@gilou
Copy link

gilou commented Nov 26, 2014

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...

@furier
Copy link

furier commented Nov 26, 2014

Error:Unexpected char!

^(?<Date>\d{4}-\d{1,2}-\d{1,2})\s+(?<Time>\d{2}:\d{2}:\d{2}),?\d{3}\s+(?<LogLevel>INFO|DEBUG|WARN|ERROR|FATAL)\s+(?<PID>\d+)\s+(?<Logger>[a-zA-Z.]*)\s+-?\s+(?:(?<Memory>\[MEMORY:\s\d+,?\d+\w+\])\s+(?<TcpConnections>\[TCP CONNECTIONS:\s\d+,?\d+\])\s)?(?<Message>.*)$
--^

No cant handle named capture groups...

@CJex
Copy link
Owner

CJex commented Nov 27, 2014

At present this tool focuses on JavaScript RegExp syntax, not PCRE.
JavaScript RegExp doesn't support named capture groups.

I had consider implementing this feature,but because this tool's goal is conforming with 《ECMAScript Standard》 ,and which syntax to support is a problem,Python or PCRE or XRegExp?

Any more suggestions?

@gilou
Copy link
Author

gilou commented Nov 27, 2014

Ah, I didn't think about the ECMAScript by default, even though it makes sense for a .js.. ;)
Well, PCRE integrated Python's notation (and .NET's) hehe, see http://pcre.org/pcre.txt

@CJex CJex added this to the PCRE milestone Dec 1, 2014
@CJex
Copy link
Owner

CJex commented Dec 5, 2014

Merge with: #16

@liudongmiao
Copy link

demo: https://jianyu.io/regulex/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants