It's a common task in NLP to either check a text against a pattern or extract parts from the text that matches a certain pattern. A regular express...
For further actions, you may consider blocking this person and/or reporting abuse
Good write! When I explain regular expressions I tend to mention the following points:
I also point people towards RegExr, especially the 'Tests' tab is amazing, make sure you also write tests for the things you do not want to match.
Great to know. I'll update the post with a link to Regexer.
The greatest danger using regular expressions is a global search and replace. I can't tell you how many times I've seen inadvertent changes cause down stream problems.
This is a super clear guide for getting started with regex! Nicely done.
Well done! Next step: groups and backreferences :P
Addition for this writing:
?
equals{0,1}
*
equals{0,}
+
equals{1,}
All info with similar visualisations on regular-expressions.info/ .
Didn't know about this. It looks super helpful. Thank you for sharing.
Great tutorial. Also the highlighting of found matches is extremely helpful. 👍
I have learned Regex with regex101.com/ - I cannot recommend this tool enough. Helped me to master Regex. Before I was a complete noob and could not understand a single expression.
I wrote a simple Windows forms utility where I can test REs. One text box for the RE I'm testing, one where I start typing in text and the utility responds with an indication of a match as I type each character.
Duh - how embarrassing is that: I've used regex for years - and only now have I learned about \D as a negation of \d! THANKS! (Can't wait to read in full to see what else I missed...)
hey @amitness cool guide for difficult stuff like RegEx. 👏
I think you got a typo in the 2nd last example.
Why should "r'batman'" in
should match only match for the occurrence at the beginning?
re.match() and re.search() work differently: stackoverflow.com/questions/180986...
Awesome how you created this guide. It's so pretty!! How do you make these diagrams?
Thank you.
I created the diagrams using excalidraw.com
Good post. Nice to read.
Could you go further explaining capturing group with
()
?Nice post on Regex on python. Your explanations are so good. Awesome.
This is a really cool reference, thanks!
Nice guide! Well done and visually appealing!
Great. Thank you.
This is one of the simplest explanations of Regular expression ever I see. I really enjoyed reading this article even I know a little bit of regex. Appreciate your efforts 😊.
Thank you Amit. You have made a great job, awaiting for the next chapters!
Thank you for this guide Amit!
@amitness very clear guide to regex. Thanks for this.
Hello, may I translate your article into Chinese?I would like to share it with more developers in China. I will give the original author and original source.
Hey, sure.
Great post
You need to change the title to something like "Using Basic Regular Expressions in Python" and tells us right in the beginning on which version of Python and the re package you tested your code.
Thank you for the suggestion. I will do that.
Pretty neat! Loved it, This is the first time someone explained Regex so well, Can I republish this content on my blog with proper mention of your profiles and original links?