Skip to content

Instantly share code, notes, and snippets.

@slwu89
Last active September 6, 2017 16:42
Show Gist options
  • Save slwu89/85df9cb95d7e9d7cf5db3710df5a591f to your computer and use it in GitHub Desktop.
Save slwu89/85df9cb95d7e9d7cf5db3710df5a591f to your computer and use it in GitHub Desktop.
stat243-unit4-regex.txt
Sean Wu 25931748
NOTE: using pcre (php) style regex tester found at https://regex101.com
# 3.1.1
regex: \bc?a?t\s
tested successfully against string: at%t$catfdsa cat at t dsfsd $#t34 adsf209 cat435 %ty
# 3.1.2
regex: (\s|^|\b)ca+t(\s|$)
tested successfully against string: caat 54%cat sdaf asdcatsdf cat caat caaaaaaaat kllkcaaatfd caaaaat43$ caat
# 3.1.3
regex: (^|\b)[dD][oO][gG](\s|$)
tested successfully against string: Dog asdog dog dfo%5g Dog dDooG dOg doG DOg doOoG dOG doGG dOOg fDdoG#53 dog
# 3.1.4
regex: (\s|^)[0-9]+\.?[0-9]*
tested successfully against string 1: -432 543.54325 432 0.0000000001 -54.543543 -1 0000.00000009
tested successfully against string 2: 432 -543.54325 432 0.0000000001 -54.543543 -1 -0000.00000009
# 3.1.5
regex: ^\s*[a-zA-Z]+\s+[a-zA-Z]+\s*$
tested successfully against strings:
lorem ipsum
Lorem ipsum dolor sit amet
lorem ipsum
loremipsum
lorem ipsum
lorem ipsum
Lorem ipsum dolor sit amet
Lorem ipsum dolor sit amet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment