Live data from Hacker News

RegExr: Learn, Build and Test Regex

regexr.com

11–20 of 52 posts

Re: RegExr: Learn, Build and Test Regex

#11
Is there a list of regex patterns for common usecases like imei/geo cordinates etc. somewhere . My google searches are leading me either to regex tutorial sites or regex libraries. There are handful of results for emails/url etc. but not getting exhaustive list.

Re: RegExr: Learn, Build and Test Regex

#12
I'd like a tool similar to this but for sed or awk usage. Like to see interactively what would be the output for given input and command. Particularly for the toolchain distributed with Ubuntu. I believe demand for such tool would be greater than just me. Let me know if you know one!

Re: RegExr: Learn, Build and Test Regex

#13

I switch between this site and debuggex.com depending on what I’m doing at the time. I find they both have their strengths for specific tasks.

What's the diff? I love regexr and credit that site to my finally understanding regex.

In fact, I was just on it this morning!

Re: RegExr: Learn, Build and Test Regex

#14

(I’m too much of an idealist for my own good.) I’m sure that these resources are great. And it’s not their fault that the regex family of languages evolved in the way that they did. But the simpler regex languages (without backreferences and other stuff… that I might not even know about) seem simple at first glance. In a perfect world I want to just spend and hour internalizing them forever. But in practice it seems…

> did I unintentionally use some metacharacter in this part of the string which I meant to be “fixed”?

When in doubt, just throw a backslash in front of it, which always means "the next character is to be interpreted literally," even in cases where it's not necessary.

(Well, not always; the backslash will invoke a special character when thrown before some letters; eg, "\t" means the tab character. But normal letters never need to be escaped; just punctuation.)

Re: RegExr: Learn, Build and Test Regex

#16
post #13

I switch between this site and debuggex.com depending on what I’m doing at the time. I find they both have their strengths for specific tasks.

What's the diff? I love regexr and credit that site to my finally understanding regex. In fact, I was just on it this morning!

I think regexr does a better job of helping you to understand exactly what is happening in the regex. I typically reach for debuggex when I already have a decent understanding of how to accomplish what I want and just want a simple way to edit & test, I think the interface is less busy for that case.

Re: RegExr: Learn, Build and Test Regex

#18

I'd like a tool similar to this but for sed or awk usage. Like to see interactively what would be the output for given input and command. Particularly for the toolchain distributed with Ubuntu. I believe demand for such tool would be greater than just me. Let me know if you know one!

I was just talking about this yesterday. I too would really appreciate a tool like this!

Re: RegExr: Learn, Build and Test Regex

#19

This one is my go-to. But it would be a lot better if it didn't display an alert when you try to leave the site. I've started to try and find alternatives.

I don't get a warning to leave the site unless I've input data into the form. I find that to be a valuable feature and not a nag.

Re: RegExr: Learn, Build and Test Regex

#20

Is there a list of regex patterns for common usecases like imei/geo cordinates etc. somewhere . My google searches are leading me either to regex tutorial sites or regex libraries. There are handful of results for emails/url etc. but not getting exhaustive list.

Do geographical coordinates have a standard layout? I'd expect that you have to look at your particular data for cases like this.

Something like IMEI should be pretty easy, if Wikipedia [0] is to be trusted (e.g. in Python):

    # Matches IMEI and IMEISV
    imei_pattern = re.compile(r"\d{2}-\d{6}-\d{6}-\d\d?")
You could write a big monster pattern that sets up capture groups for all the different TAC and Check Digit variants, but why bother? Just slice off what you need from the result after matching.

0: https://en.wikipedia.org/wiki/International_Mobile_Equipment...

Post reply on HN