Welcome to WebmasterWorld Guest from 54.167.216.239

Forum Moderators: coopster & jatar k

Can regular expression ignore characters?

     
12:35 am on Nov 29, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member ogletree is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 14, 2003
posts: 4311
votes: 36


I'm using a chrome plugin to remap words on a webpage to anonymize keywords.

I can use Regex.

I want it to find a keyword like blue shoes and change it to keyword 1 and red shoes and call it keyword 2.

The hard part is to get it so it ignores the plus sign.

I could just write 2 statements but I was wondering if I could do it with just one so that it would find blue shoes even if it looked like blue shoes or +blue +shoes.
2:03 am on Nov 29, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14712
votes: 614


This is easier to answer if you show the syntax of the search you're working with. Consider a typical search engine, where certain characters are “reserved” and therefore ignored altogether. That’s one approach. The opposite is to start by globally deleting all + signs, making sure that you retain a space (“+blue+shoes” >> “blue shoes”, not “blueshoes”). Where do the + signs come from in the first place? If you're searching for a two-word phrase, do the words have to be contiguous--aside from punctuation--or might they just be in the general vicinity of each other? Again in search-engine terms, there is a difference between
blue shoes
and
"blue shoes"

And then there are the site searches that work worse and worse the more effort you put in, because they don't bother to tell you that the implicit operator is not AND but OR.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members