Skip to content
Advertisement

Tag: regex

Regex for matching HashTags in any language

I have a field in my application where users can enter a hashtag. I want to validate their entry and make sure they enter what would be a proper HashTag. It can be in any language and it should NOT precede with the # sign. I am writing in JavaScript. So the following are GOOD examples: Abcde45454_fgfgfg (good because: only

Javascript Regex – Get All string that has square brackets []

I have string data below: I need to get all strings that contain square brackets []. This is the result that I want. I’ve tried using regex /[(.*?)]/, but what I’ve got is an only the first array element is correct, the next elements are basically the same value but without the square brackets. What regexp should I use to

JavaScript Regex to capture repeating part of decimal

Looking for the best way to take an arbitrary number with potentially repeating decimal part, and discover the repeating part (if present). Ultimately, I need to decorate the number with overline notation (either with css text-decoration or MathML mline), so I need to know the index of where the repetition begins also. So I need regex that will get me

Javascript: Named Capture Groups

I need to match an expression and extract values from it using named groups. Lets say this is my string: So i want to match it using regex and extract the element and value. I know how to do it is c#, I am trying to figure it out in JS. This is my regex: What am I doing wrong?

REGEX to match only VALID EXCEL COLUMNS (A-XFD)

Ok, I have ANOTHER REGEX question for everyone. I have a field that has multiple validation steps. The first step is to ensure it isn’t blank, second is to ensure that only between 1 and 3 CAPITAL LETTERS are entered, and third, to ensure it doesn’t contain “[” (an opening bracket will denote a function in this scenario and we

regexp to allow only one space in between words

I’m trying to write a regular expression to remove white spaces from just the beginning of the word, not after, and only a single space after the word. Used RegExp: Test Exapmle: Only one space should be allowed. Is it possible? Answer BTW, new RegExp(..) is redundant if you use regular expression literal.

Concrete JavaScript regular expression for accented characters (diacritics)

I’ve looked on Stack Overflow (replacing characters.. eh, how JavaScript doesn’t follow the Unicode standard concerning RegExp, etc.) and haven’t really found a concrete answer to the question “How can JavaScript match accented characters (those with diacritical marks)?” I’m forcing a field in a UI to match the format: last_name, first_name (last [comma space] first), and I want to provide

Advertisement