Skip to content

Instantly share code, notes, and snippets.

@Galarius
Last active August 29, 2015 14:14
Show Gist options
  • Save Galarius/465237360d467e1f4786 to your computer and use it in GitHub Desktop.
Save Galarius/465237360d467e1f4786 to your computer and use it in GitHub Desktop.
regex snippets
http://regexone.com/
------------------------------------
task:
match text 3.14529
match text -255.34
match text 128
match text 1.9e10
match text 123,340.00
skip text 720p
regex: ^-?\d+(,\d+)*(\.\d+(e\d+)?)?$
------------------------------------
task:
your task text capture
capture text 415-555-1234 415
capture text 650-555-2345 650
capture text (416)555-3456 416
capture text 202 555 4567 202
capture text 4035555678 403
capture text 1 416 555 9292 416
regex: 1?[\s-]?\(?(\d{3})\)?[\s-]?\d{3}[\s-]?\d{4}
------------------------------------
task:
your task text capture
capture text tom@hogwarts.com tom
capture text tom.riddle@hogwarts.com tom.riddle
capture text tom.riddle+regexone@hogwarts.com tom.riddle
capture text tom@hogwarts.eu.com tom
capture text potter@hogwarts.com potter
capture text harry@hogwarts.com harry
capture text hermione+regexone@hogwarts.com hermione
regex: ^([\w.]*)
------------------------------------
task:
your task text capture
skip text .bash_profile
skip text workspace.doc
capture text img0912.jpg img0912, jpg
capture text updated_img0912.png updated_img0912, png
skip text documentation.html
capture text favicon.gif favicon, gif
skip text img0912.jpg.tmp
skip text access.lock
regex: (\w+)\.(jpg|png|gif)$
------------------------------------
task:
your task text capture
capture text The quick brown fox... The quick brown fox...
capture text jumped over the lazy dog. jumped over the lazy dog.
regex: ^\s*([\w\s.]*)\s*$
Wavefront .obj regex
------------------------------------
task: v v1 v2 v3
regex: v\s*(-?[0-9]+\.[0-9]*e-\d+|-?[0-9]*e-\d+|-?[0-9]+\.[0-9]*|-?[0-9])\s*(-?[0-9]+\.[0-9]*e-\d+|-?[0-9]*e-\d+|-?[0-9]+\.[0-9]*|-?[0-9])\s*(-?[0-9]+\.[0-9]*e-\d+|-?[0-9]*e-\d+|-?[0-9]+\.[0-9]*|-?[0-9])
------------------------------------
task: f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 OR f v1//vn1 v2//vn2 v3//vn3 OR f v1 v2 v3 OR f v1/vt1 v2/vt2 v3/vt3
regex: f\s(-?[0-9]*)/?(-?[0-9]*)?/?(-?[0-9]*)?\s(-?[0-9]*)/?(-?[0-9]*)?/?(-?[0-9]*)?\s(-?[0-9]*)/?(-?[0-9]*)?/?(-?[0-9]*)?
------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment