Created
March 3, 2015 22:26
-
-
Save G4MR/785c7ad4c8cd03f45771 to your computer and use it in GitHub Desktop.
nim/regular expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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