Regexp tester
In the digital age, we are constantly bombarded with information from all directions. From the moment we wake up to the time we go to bed, our lives are intertwined with technology and media. We use smartphones to communicate with friends and family, browse social media for entertainment, and rely on computers for work and education. As we navigate this interconnected world, we encounter a myriad of characters, symbols, and numbers. From the letters of the alphabet to punctuation marks like commas and periods, each symbol plays a crucial role in conveying meaning and facilitating communication. Additionally, we encounter digits ranging from 0 to 9, which are used for numerical representation and calculations. Moreover, our digital landscape is filled with special characters such as @, #, $, %, and &, which serve various functions in different contexts. For example, the @ symbol is commonly used in email addresses, while the # symbol is often used in social media hashtags. These characters add richness and complexity to our online interactions, allowing us to express ourselves in unique ways. In conclusion, the digital world is a diverse and dynamic environment filled with characters, digits, and elements that shape our everyday experiences. By understanding and embracing this diversity, we can navigate the digital landscape with confidence and creativity.
Regexp tester
- Pattern:
/\w/g
Description: Character search.
Explanation: This pattern searches for any word character (letters, digits, or underscores). The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/^\w+$/
Description: Validating a name. Matches strings containing only letters and numbers.
Explanation: This pattern validates names by ensuring that they contain only word characters (letters, digits, or underscores) from the beginning (^) to the end ($) of the string. - Pattern:
/\W/g
Description: Non-character search.
Explanation: This pattern searches for any non-word character (anything other than letters, digits, or underscores). The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/\d/g
Description: Digit or number search.
Explanation: This pattern searches for any digit character (0-9). The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/\D/g
Description: Non-digit search.
Explanation: This pattern searches for any non-digit character. The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/\s/g
Description: Whitespace search.
Explanation: This pattern searches for any whitespace character (space, tab, newline, etc.). The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/\S/g
Description: Non-whitespace search.
Explanation: This pattern searches for any non-whitespace character. The 'g' flag ensures a global search, finding all matches in the string. - Pattern:
/\n/
Description: New line position search.
Explanation: This pattern searches for the position of a newline character in the string. - Pattern:
/\f/
Description: Form feed position search.
Explanation: This pattern searches for the position of a form feed character in the string. - Pattern:
/\r/
Description: Carriage return position search.
Explanation: This pattern searches for the position of a carriage return character in the string. - Pattern:
/\t/
Description: Tab position search.
Explanation: This pattern searches for the position of a tab character in the string. - Pattern:
/\v/
Description: Vertical tab position search.
Explanation: This pattern searches for the position of a vertical tab character in the string. - Pattern:
/o+/g
Description: Global search for letter 'o'.
Explanation: This pattern searches for one or more occurrences of the letter 'o' in the string. The 'g' flag ensures a global search, finding all matches. - Pattern:
/10?/g
Description: Global search for '10' with optional '0'.
Explanation: This pattern searches for the string '10', with the '0' being optional. The 'g' flag ensures a global search, finding all matches. - Pattern:
/te?/g
Description: Global search for 'te' with optional 'e'.
Explanation: This pattern searches for the string 'te', with the 'e' being optional. The 'g' flag ensures a global search, finding all matches. - Pattern:
/\d{3}/g
Description: Search for numbers with 3 digits.
Explanation: This pattern searches for sequences of three consecutive digits in the string. The 'g' flag ensures a global search, finding all matches. - Pattern:
/\d{4,}/g
Description: Search for numbers with at least 4 digits.
Explanation: This pattern searches for sequences of four or more consecutive digits in the string. The 'g' flag ensures a global search, finding all matches. - Pattern:
/\d{4,6}/g
Description: Search for numbers with 4 to 6 digits.
Explanation: This pattern searches for sequences of four to six consecutive digits in the string. The 'g' flag ensures a global search, finding all matches. - Pattern:
/.html$/
Description: Search for '.html' at the end of a string.
Explanation: This pattern searches for the string '.html' occurring at the end of the string. - Pattern:
/^https:/
Description: Search for 'https:' at the beginning of a string.
Explanation: This pattern searches for the string 'https:' occurring at the beginning of the string. - Pattern:
/example(?!.com)/g
Description: Search for 'example' not followed by '.com'.
Explanation: This pattern searches for the string 'example' only when it is not followed by '.com'. The 'g' flag ensures a global search, finding all matches. - Pattern:
/example(?=.com)/g
Description: Search for 'example' only followed by '.com'.
Explanation: This pattern searches for the string 'example' only when it is followed by '.com'. The 'g' flag ensures a global search, finding all matches. - Pattern:
/https?:\/\/[^\s]+/g
Description: Search for URLs.
Explanation: This pattern searches for URLs in the string. - We use `https?` to search where 's' is optional. - `:\/\/` matches `://`. - `[^\s]+` Matches one or more characters that are not whitespace. - We use the `g` global flag to find all matches in the string. - Pattern:
/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g
Description: Search for email addresses.
Explanation: This pattern searches for email addresses in the string. - [a-zA-Z0-9._%+-]+ matches the local part of the email (before the @ symbol). - @[a-zA-Z0-9.-]+ matches the domain part of the email (after the @ symbol). - \.[a-zA-Z]{2,} matches the top-level domain (e.g., .com, .org) with at least two characters. - Pattern:
/(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/g
Description: Search for URLs (HTTP, HTTPS, or FTP).
Explanation: This pattern searches for URLs starting with 'http', 'https', or 'ftp' in the string. - (https?|ftp) matches either 'http', 'https', or 'ftp'. - :\/\/ matches the '://' sequence. - [^\s/$.?#].[^\s]*$ matches the rest of the URL, allowing any character except whitespace, '/', '$', '.', '?', and '#'. - Pattern:
/(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/g
Description: Search for dates in YYYY-MM-DD format.
Explanation: This pattern searches for dates in the YYYY-MM-DD format. - (19|20)\d{2} matches years from 1900 to 2099. - -(0[1-9]|1[0-2])- matches months from 01 to 12. - -(0[1-9]|[12]\d|3[01]) matches days from 01 to 31, considering leap years and varying days in months. - Pattern:
/#[a-fA-F0-9]{6}/g
Description: Search for hexadecimal color codes.
Explanation: This pattern searches for hexadecimal color codes in the #RRGGBB format. - #[a-fA-F0-9]{6} matches the # symbol followed by six hexadecimal characters (0-9, a-f, or A-F) representing red, green, and blue components. - Pattern:
/(?<=\s|^)[A-Z][a-z]+(?:[A-Z][a-z]+)*(?=\s|$)/g
Description: Search for capitalized words.
Explanation: This pattern searches for words that start with a capital letter, followed by lowercase letters, allowing multiple words with spaces. - (?<=\s|^) ensures that the word starts with a space or is at the beginning of the string. - [A-Z][a-z]+ matches a capitalized word. - (?: [A-Z][a-z]+)* allows multiple words separated by spaces. - (?=\s|$) ensures that the word ends with a space or is at the end of the string.