I want to implement wild card query in solr. I want that when I search for query= ****diamond, it should search for whiltediamond etc. ie all '*' should be replaced by '' (blank) except 1 * ie. it should run as *diamond, I am using
query=query.replace(/[^a-zA-Z 0-9 * ? : .]+/g,'');
It means other than *, ?, :, . it is replacing all special characters by a ”. now i want to convert it as that it should replace all * leaving one * by ''.
Than what should be regular expression.
Your regex should do the following:
Replace any number of asterisks by only one asterisk: