Skip to content
Advertisement

Tag: string-matching

How to detect regex pattern for strings with underscore

I am trying to create a regex for detecting the number of exact occurance of a string in another string. Here I am getting the exact match for “test” string and nothing else, but it’s ignoring all the “test” strings which have underscore associated with it either front or back(like TEST_UF… or r_test or the regex-test_, the “test” string is

javascript regular expression to check for IP addresses

I have several ip addresses like: 115.42.150.37 115.42.150.38 115.42.150.50 What type of regular expression should I write if I want to search for the all the 3 ip addresses? Eg, if I do 115.42.150.* (I will be able to search for all 3 ip addresses) What I can do now is something like: /[0-9]{1-3}.[0-9]{1-3}.[0-9]{1-3}.[0-9]{1-3}/ but it can’t seems to work

Advertisement