Useful Regexes

PREMISE

This contains various regexes that I find useful.

Match any character except newline

.

Match particular first word of a string on a multiple lines

/(word1|word2|word3)/igm

Match multiple lines of negative and positive floating point numbers with a value less than 1000.

/^-?\d{1,3}\.\d+$/igm

Do not return result from a group

(?:)

For example, do not return the year from this string:
12/06/2016 05:52

(^\d{2}\/\d{2}\/(?:2015|2016) (\d{2}:\d{2})$)

You'll note that everything else is being captured, as well as the time being caputured by a specific group. However, this will not include 2015 or 2016.

Doesn't start with http

/^((?!http).)*$/

Resource: https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word

Remove http(s) from every line

s/^http.?:\/\///g