I try to convert the html text into inline text without spaces between tags or between text inside tag but without text losing the spaces. Check the code below for more infos. I try to ‘write’ the regex below but it is wrong. I now remove the tag too. I tried different regex methods but I can’t create (or understand)
Tag: regex
do you know how to modify the regex to allow one ‘-‘ char at the beginning of the string
i have the existing regex pattern: /^-?(?!0d)d+.?d*$/, Currently the above regex do not allow – char at beginning of the string Do you know how to modify the regex to also allow one ‘-‘ input besides the above existing validation My attempt: but it doesn’t work well. Answer To modify the regex and accept only a – as well, you
How to match multiple words in multiple lines
I have a multiline text, e.g. I need to see if two words present in whole text (AND operator). I tried something like: Answer You can try this regex: [sS] matches literally everything, encluding line wraps b is the word bound, so word1 count but sword1 does not. And since you treat all the lines as a whole, you dont
Validate Range of Numbers
I am trying to validate a comma separated list of numbers 1-384 unique (not repeating). i.e. 1, 2, 3, 5, 6, 7, 9 is valid 1-3, 5-7, 9 is valid 2, 2, 6 is invalid 2, is invalid 1, 2, 3, 4, 15, 6, 7, 385 is invalid because the last number is more than 384 I have tried the
How to convert string into regex with the words more than 3 character?
I am trying to create a ABRV from string. I can achieve some result , but not the final expected one. For example, if I have INTERNATIONAL Monetary Fund ltd string, I need to get IMF from it. I have tried this one, but it only returns IMFl. I need to restrict it to count only words with more than
Match specific string which not contains specific pattern
I have urls and want to match only those which match this pattern but not contains this type=inbox – so for example – regexp should give following results: I try this but get wrong results (good only when type=inbox is at the end of string) How to do it using JavaScript RegExp? Answer The pattern that you tried asserts that
regex for unicode charachters (persian numbers)
I have a regex for validating persian date like this: but testing in this test link does not pass. am I doing any thing wrong? Answer thanks to @JvdV, I made a mistake in getting unicode of the persian number characters. the right regex would be:
Need help to match regex with conditional concatenation (JS)
I need help to accomplish the use cases of this regex: https://regex101.com/r/HmDQHJ/3/ Right now, my issue is that I need to match this: But also fail on this: Can someone help me to accomplish this? Thank you! More context: We have an old crawler that goes project source and looks for usage of a function called “T”, then it should
what I cant splir the char of ‘(‘ using this regexp in javascipt
the var codigo have the value *int a,h;float b,c;a=b*(c+h); my regex is: and as a output im getting this: why after the ‘*’ the ‘(‘ isnt splitting right ? when the ‘)’ its doing correctly? Answer In Regular Expressions, since . represents any character, it should be enough to split by the following regex: and then remove the empty string
why is split returning empty strings even tho capturing parenthesis are not present?
My code: That outputs [“”, “a”, “”, “b”, “”]. Why are the empty strings present? Quoting https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split , If separator is a regular expression that contains capturing parentheses, then each time separator is matched, the results (including any undefined results) of the capturing parentheses are spliced into the output array. However, not all browsers support this capability. That’s clearly not