benkeen / grunt-search

Grunt plugin that searches a list of files and logs all findings in various formats.
MIT License
15 stars 8 forks source link

Wrong example #7

Closed arif-dewi closed 9 years ago

arif-dewi commented 9 years ago

Dear Ben Keen! Do you know that documentation is not correct? I spend 2 hours trying to find out what I do wrong. This plugin doesn't expect regex itself - only inside part of it. For example - I was trying to find usages of obsolete jQuery function using /toggle()/ and you code turns it into //toggle()//g - so sure it wouldn't work. You wrote that we can use /bla-bla-bla/ but we should put only bla-bla-bla inside searchString param otherwise it will find nothing. Have a nice day!

benkeen commented 9 years ago

Hmm! That's curious... did you possibly pass a reg exp inside a string, or a reg exp itself? (i.e. /bla-bla-bla/ vs "/bla-bla-bla/"? I'd have sworn it worked that way - but I can confirm.

arif-dewi commented 9 years ago

Really curious =) But I debugged it today. I used /toggle()/ as is - not as a string - just as in example. And it was wrapped inside regex again. I just realize maybe check for regex decided that was a string somehow. I`ll try ti check this tomorrow. Now correct version is toggle() without slashes before and after.

arif-dewi commented 9 years ago

I found the reason. Your code works perfectly - excuse me. I used a yaml file as a config and it returns regexp as a string. So you can close this issue. Have a nice day and thank you for immediate answer!

benkeen commented 9 years ago

Ah! Good to know, thanks @andrewdonskikh :)