AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Regex cheatsheet12/27/2023 ![]() The character classes operators allow you to match characters inside a category (class). Matches any string that contains an ‘a’ followed either by ‘b’, ‘c’, or ’d' Matches any string that contains the text ‘se’ followed either by an ‘a’ or an ‘e’ Is used to represent a list, so it matches a string that contains one of the characters inside the list ![]() Matches any string that contains either ‘a’ or ‘b’ Matches any string that repeats the group of characters ‘ha’ two up to four times Matches any string ‘hello’ followed by zero or one ‘!’ characters Matches any string ‘hello’ followed by one or more ‘!’ characters Matches any string ‘hello’ followed by zero or more ‘!’ characters Used to specify the minimum (‘n’) and maximum (’m') number of times the previous character (‘x’) should appear Used to specify the minimum number of times (‘n’) the previous character (‘x’) should appear Used to specify the number of times (‘n’) the previous character (‘x’) should appear Quantifiers are used to represent the times we want the preeceding character or group of characters to appear in our match. Matches any string that contains the text ‘order’ in it Matches a string that ends with the ‘end’ sequence of characters “ An apple is in the tree”, “ A new restaurant” Matches all the strings that start with an A ![]() Matches any string that contains the ‘abc’ characters sequence on it This will match any string that ends with the character(s) before the ‘$’ symbol It will only match the string that begins with the character(s) that follows You can also test your regular expressions with some explanations of them on this page. The following sections will show the different operators used for regex and some examples. Regex is widely used in multiple programming languages using almost the same syntax, so this article pretends to show the basic regex operators. Regex can be used to validate inputs, web scrapping, finding specific strings in documents, syntax validation for compilers, and so many others examples. Regular Expressions (regex or regexp) are a very useful tool to identify specific patterns in any text, which helps to extract information regardless the format of the text.
0 Comments
Read More
Leave a Reply. |