+ 1

Why use Regexp?

Regexp are regular expressions, such at /ab+c/. But why would anyone want to use Regexp? I would appreciate an explaination to the use of Regexp and maybe an example code 😁😆😎 Thank you!

19th Sep 2017, 9:45 PM
koala 🐨
koala 🐨 - avatar
2 odpowiedzi
+ 3
RegExp is used to query and search in texts and find matches, for example /(A-Z)/ this expression means all capital letters from a to z , it's really useful in special occasions, but sometimes is so vulnerable and Slow performing,checkout Snyk website for more info about JS vulnerabilities unfortunately some core functions in JS like String.prototype.replace() uses only regexp to find and replace texts I suggest that you get used to it. a least and necessary syntax is helpful to get the job done
19th Sep 2017, 11:52 PM
Ali Sawari
Ali Sawari - avatar
+ 2
Regexp is mostly used for manipulating data in files, extracting information or validating inputs like I did with this code below. Only problem is, I didn't know about Regexp when I created this code. With Regexp, this code would've been shorter. https://code.sololearn.com/chIniR1Eu4kG/?ref=app
19th Sep 2017, 10:09 PM
Ghauth Christians
Ghauth Christians - avatar