Created
October 23, 2019 02:29
-
-
Save tianmingzuo/be04a634e27eaccc1ad8685263dca2e8 to your computer and use it in GitHub Desktop.
Check For Mixed Grouping of Characters: If you want to find either Penguin or Pumpkin in a string, you can use the following Regular Expression: /P(engu|umpk)in/g: let testStr = "Pumpkin"; let testRegex = /P(engu|umpk)in/g; testRegex.test(testStr); Fix the regex so that it checks for the names of Franklin Roosevelt or Eleanor Roosevelt in a case…
This file contains hidden or 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
| let myString = "Eleanor Roosevelt"; | |
| let myRegex = /(Franklin ([A-Z]\. )?|Eleanor ([A-Z]\. )?)Roosevelt/; | |
| let result = myRegex.test(myString); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment