Skip to content

Instantly share code, notes, and snippets.

@Hamz-a
Last active March 25, 2022 15:04
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Hamz-a/1662d09db09156e8b2b0 to your computer and use it in GitHub Desktop.
Save Hamz-a/1662d09db09156e8b2b0 to your computer and use it in GitHub Desktop.

Reference - What does this regex mean?

What is this?

This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it.

Why is this?

[tag:regex] is suffering from give me ze code type of questions and poor answers with no explanation. This reference is meant to provide links to quality Q&A.

What's the scope?

This reference is meant for the following languages: [tag:php], [tag:perl], [tag:javascript], [tag:python], [tag:ruby], [tag:java], [tag:.net].
This might be too broad, but these languages share the same syntax. For specific features there's the tag of the language behind it, example:

  • What are regular expression Balancing Groups? [tag:.net]

The list

Quantifiers:

Character classes:

Anchors:

Groups:

Lookaround:

Modifiers:

Escape sequence:

Other: not sure about the name ...

Control verbes: [tag:php] [tag:perl]

Recursion: [tag:php] [tag:perl]

Advanced regex-fu

@rschrieken
Copy link

Should I leave comments or edit directly? if the latter: How?

@Hamz-a
Copy link
Author

Hamz-a commented Mar 30, 2014

You can fork it and then I will merge it.

Copy link

ghost commented Apr 6, 2014

How do you merge a gist?

@Hamz-a
Copy link
Author

Hamz-a commented Apr 8, 2014

@kyRAD you can clone your gist on your disk, pull another (updated) gist and then push it

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Mar 24, 2022

You really should make this a repo, even if all it contains is a single readme. Repos have better interaction, better maintainability, etc.

To everyone else: here is the Stack Overflow community wiki started by @Hamz-a with the above content, I believe, plus even more: Reference - What does this regex mean?

@Hamz-a
Copy link
Author

Hamz-a commented Mar 25, 2022

@ElectricRCAircraftGuy I actually forgot I've even put this on GitHub (as a gist). The most up to date version is on Stack Overflow with contributions of the community. I don't think it makes sense to have two versions of the reference. I'm not sure why I even put it on GitHub.

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