You are not logged in.
Hmm So while I love the idea and concept behind this project, not quite sure how easy it will be to actually learn. Probably still easier than actual regex.... What am I babbling about? Well I came across the opensource project to make and translate a fully featured regex tool using English. (Maybe other languages to come later?)
Check it out here: https://simple-regex.com/
The Github: https://github.com/SimpleRegex
So I know some of the guys here are probably wizzes at crafting carefully poised strings of periods, escape characters, brackets, colons etc.. but I really really tried to learn it, and it's just so finicky and ultra precise in it's syntax, it makes it mind numbing at times. Literally one missed period can change the meaning of the entire string...or even cause it not to work completely...So I was pretty stoked to find this project. This language apparently will allow you to write a regex using English. Refered to below as SRL.
So what does this look like:
REGEX: grep -e '[eE]rror' system.log
SRL: one of "eE" system.log
Now for this example, there's not really much saved or translated, but that's just a taste
Take for example this:
SRL:
begin with either of (number, letter, one of "._%+-") once or more,
literally "@",
either of (number, letter, one of ".-") once or more,
literally ".",
letter at least 2 times,
must end, case insensitive
REGEX:
/^(?:[0-9]|[a-z]|[\._%\+-])+(?:@)(?:[0-9]|[a-z]|[\.-])+(?:\.)[a-z]{2,}$/i
I think this example sort of spells it out (no pun..)
You can run translations on their website that lets you test your SRL strings and even see the equivalent regex strings
https://simple-regex.com/build/
Now, my problem with this...is that the syntax is English yes, but it's still sort of pseudo code like in it's implementation. Now if you're really adept at regex, you very well could find very short and super precise, but I can see the appeal of this for people not really willing to devote the time to learning regex. I haven't played around with it too much, but it seems like it still requires a decent amount of effort, but less of a learning curve?
Example of matching URLs:
REGEX:
/^(?<protocol>[a-z]+)(?::\/\/)(?<domain>[a-z]+(?:[a-z]|(?:\.))+[a-z]{2,})(?:(?::)(?<port>[0-9]+))?(?<path>(?:\/).*?)(?:(?:\?)|$)(?:\?)?(?<parameters>.*)?$/i
SRL:
begin with capture (letter once or more) as "protocol",
literally "://",
capture (
letter once or more,
any of (letter, literally ".") once or more,
letter at least 2 times
) as "domain",
(literally ":", capture (digit once or more) as "port") optional,
capture (literally "/", anything never or more) as "path" until (any of (literally "?", must end)),
literally "?" optional,
capture (anything never or more) as "parameters" optional,
must end,
case insensitive
So what say you guys? This something that you think has a place? Or too gimmicky? Some expressions, especially the fact that regex has so many versions and variations, favors the SRL attempt, seeing the above output...Regex still seems "less" work, but in terms of intution I'm not sure...
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
I like the wordy version better, however a system that could generate selector/regex with me popping in input and wanted output would be more than welcome (Much more than translator). The more Phylosophical stance would be, that if you need to match url this way, you are probably using wrong method (I know it's just an example, but perhaps a better one is needed).
Last edited by brontosaurusrex (2017-06-18 07:20:37)
Offline
Nice tool, like ufw but for regex, right?
I do find that startpage.com is pretty good at constructing complex regex statements on my behalf
Offline
Nice tool, like ufw but for regex, right?
I do find that startpage.com is pretty good at constructing complex regex statements on my behalf
Who are you trying to be modest with HoaS? We all know you that you have the entire Regex language mapped out in your head... You order pizza's using grep regex statements
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline