Skip to content

Tag: regex

Regex to Identify Month from the first 3 letter

I have a date format of 12March2018 I am trying to get a regular expression to identify the pattern using a regex expression. 1st letter must be numeric.Followed by the first 3 letters of the month. If the word which follows the numeric matches with any first 3 letter of any month it should return true. How d…

Dynamic Regex for Decimal Precision not Working

I have the following hard-coded RegEx expression for decimal precision & scale, which works (in another project): However, I don’t want to hard-code multiple variations. And, interestingly, the following fails…but I don’t know why. I “think” the concatenation may (somehow) be…

Regex for not containing consecutive characters

I can’t figure out javascript regex that would satisfy all those requirements: The string can only contain underscores and alphanumeric characters. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. This is as far as I came, but &#82…

Javascript regex get only page number from URL

i have URL like https://example.com/my-list/page/35/?a=45&b=56 I want to get page number using regex that is after /page/ in url, the result i want is 35 Answer There’s 2 easy ways you could do it using RegEx: The first way: The second way: You can also split the string, and then use regex to grab j…

JavaScript automatic comma

In my program, the user enters values betweeen 0 and 8. For example: if the user wants to input “3,4” he only needs to write “34”. the program will eventually put the comma in, but I have no clue how to do it. So: input = “34” –> output = “3,4” input = …

Regex pattern for Malaysian mobile phone Number

Regex pattern ^(+?6?01)[0|1|2|3|4|6|7|8|9]-*[0-9]{7,8}$ in HTML5 input return error. I tested the regex, no errors on regex101.com as well as in my php code. But in HTML5 it does not function as it be. My code: Error: textfield.js:146 Pattern attribute value ^(+?6?01)[0|1|2|3|4|6|7|8|9]-*[0-9]{7,8}$ is not a …

Regex match HTML attributes names

I have the following element stored as a String: I want to extract all the attributes names like this: This is what I tried to do, but I get also the values and dosent match the data-animation and disabled: http://jsbin.com/hibebezibo/edit?js,console EDIT: Manged to get attributes using: But I still cant get …