Skip to content

Instantly share code, notes, and snippets.

@G4MR
Created March 3, 2015 22:26
Show Gist options
  • Save G4MR/785c7ad4c8cd03f45771 to your computer and use it in GitHub Desktop.
Save G4MR/785c7ad4c8cd03f45771 to your computer and use it in GitHub Desktop.
nim/regular expressions
import re
let foundyou = "foobar"
let foostart = re("^foo", {reIgnoreCase, reExtended, reMultiLine})
let barstart = re("^bar", {reIgnoreCase, reExtended, reMultiLine})
if foundyou.find(foostart) != -1:
echo "found foo at start!"
if foundyou.find(barstart) != -1:
echo "found bar at start!"
if foundyou.match(foostart):
echo "Found foo at start, match method/proc"
if foundyou.match(barstart):
echo "Found bar at start, match method/proc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment