Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've got a series of strings that I want to match against the elastic search query string syntax. For those who don't know, it goes something like this

F* --> Match an 'F' followed by zero or more characters
F? --> Match an 'F' followed by one character
FRO~ --> fuzzy match, matches 'FOR'

Is there some javascript way to run a match like this

pattern = "F*";
field_name = "Frog"
matches = field_name.match(pattern);

if(matches){
    alert(field + " was a match!");
}

such that the alert message would get read? Are there any libraries for doing this sort of thing?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.