Top "Regex" questions

Regular expressions provide a declarative language to match patterns within strings.

How can I add a string to the end of each line in Vim?

I want to add * to the end of each line in Vim. I tried the code unsuccessfully :%s/\n/*\n/…

regex vim replace match
Is it worth using Python's re.compile?

Is there any benefit in using compile for regular expressions in Python? h = re.compile('hello') h.match('hello world') …

python regex
Regex matching in a Bash if statement

What did I do wrong here? Trying to match any string that contains spaces, lowercase, uppercase, or numbers. Special characters …

regex bash if-statement
How do I grep for all non-ASCII characters?

I have several very large XML files and I'm trying to find the lines that contain non-ASCII characters. I've tried …

regex unix unicode grep
What special characters must be escaped in regular expressions?

I am tired of always trying to guess, if I should escape special characters like '()[]{}|' etc. when using …

regex
How to extract base URL from a string in JavaScript?

I'm trying to find a relatively easy and reliable method to extract the base URL from a string variable using …

javascript regex string url
deny direct access to a folder and file by htaccess

Here is the scenario: There is a index.php file in root folder some files are included in index.php …

php regex apache .htaccess mod-rewrite
regular expression: match any word until first space

I have the following line: hshd household 8/29/2007 LB I want to match anything that comes before the first space (whitespace). …

regex
Regular expression for matching HH:MM time format

I want a regexp for matching time in HH:MM format. Here's what I have, and it works: ^[0-2][0-3]:[0…

regex
Decimal number regular expression, where digit after decimal is optional

I need a regular expression that validates a number, but doesn't require a digit after the decimal. ie. 123 123. 123.4 would all …

regex