Browse Source

regex practice: character classes & lookarounds.

wes 4 years ago
parent
commit
393574d501
2 changed files with 30 additions and 0 deletions
  1. 9 0
      snippets/regex_character_classes.txt
  2. 21 0
      snippets/regex_lookaround_practice.txt

+ 9 - 0
snippets/regex_character_classes.txt

@@ -0,0 +1,9 @@
+(?<=\s)\w+(?=\s)
+
+^ see solution above
+
+// find all stand-alone words: a stand-alone word contains only a-fA-F0-9 and _
+there once was a typo left out of the refifo, and it was made of CHEE_SE this wasn't the way, as they say, that it was supposed to be.  All the shoes in all the shoes boxes had 88or 99 laces.  THe_y were not grey or ugly in any way but that is for you and not me.  A hiccup for the typo was hiding in plain sighto brining much glee.  this is a w0R_____D and Th4t is a wurd and no let;s see% wat i s n t a word, how about &This or HowAbout_that? And that is the story about typo.
+
+// your solution may use up to 13 characters in the regex
+// hint: in this test "glee." does not match because glee is not stand-alone

+ 21 - 0
snippets/regex_lookaround_practice.txt

@@ -0,0 +1,21 @@
+find all the words that are digits concatenated with wez
+10wez 555em 67kyl 65wez 88.wez 4950awez 094kyl
+45kyl 38em
+kylwez100 1wez 099104882090990139wez wezwez 0wez
+10000000000000000000000000000000000000000000000000000000000kyl
+        34wezle
+99em kyl02wez 88wez
+
+find all the words that are digits concatenated with wez
+10wez 555em 67kyl 65wez 88.wez 4950awez 094kyl
+45kyl 38em
+kylwez100 1wez 099104882090990139wez wezwez 0wez
+10000000000000000000000000000000000000000000000000000000000kyl
+        34wezle
+99em kyl02wez 88wez
+*34wez
+1wez
+
+wesley solution [kyles help]	(?<![^ \n])([0-9]+wez)(?![^ \n])
+KE solution 						(?<=[ \n])[0-9]+wez(?=[ \n])
+