We help IT Professionals succeed at work.

Implement a function similar to grep in vanilla Javascript

ltpitt
ltpitt asked
on
229 Views
Last Modified: 2017-03-07
Hello,

I have a long multi line string and I would like to output only the row containing a specific word.

I saw that there is a jQuery implementation of grep but I'd need a vanilla Javascript solution.

Can you help?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Easy and perfect!

I didn't think of RegEx, thanks.
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
You are welcome.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.