I’m trying to fetch the value of currency from the JSON file and if it’s USD then I need to change it to AUD. When I tried to search the currency attribute in the json file return undefined as below: Code: Output: Got undefined data.json: Can someone help me how to update the currency value in the JSON file and
Tag: regex
How can I find repeating pairs of characters with a regex?
Trying to use regex to replace any occurrences of any set of two characters which repeat in a string. I would like for such patterns to be replaced with one occurrence of the repeating substring and the number of times it was repeated. For example, in this string below, I would like: qwertyabababababababababababa to become: qwertyab11a Similarly, a a a
RegExp for an identifier
I am trying to write a regular expression for an ID which comes in the following formats: 7_b4718152-d9ed-4724-b3fe-e8dc9f12458a b4718152-d9ed-4724-b3fe-e8dc9f12458a [a_][b]-[c]-[d]-[e]-[f] a – optional 0-3 digits followed by an underscore if there’s at least a digit (if there is underscore is required) b – 8 alphanumeric characters c – 4 alphanumeric characters d – 4 alphanumeric characters e – 4 alphanumeric
How to set the regex for this in javascript?
Usernames are used everywhere on the internet. They are what give users a unique identity on their favorite sites. You need to check all the usernames in a database. Here are some simple rules that users have to follow when creating their username. Usernames can only use alpha-numeric characters. The only numbers in the username have to be at the
Match all instances of character except the first one, without lookbehind
I’m struggling with this simple regex that is not working correctly in Safari: It should match each ?, except of the first one. I know that lookbehind is not working on Safari yet, but I need to find some workaround for it. Any suggestions? Answer You can use an alternation capture until the first occurrence of the question mark. Use
JS Regex match numbers between brackets
I have the following code, but getting no output. When I run it here it seems to work: https://regex101.com/r/FVkJfF/1 To clarify, I aim to capture all the values between the brackets if they contain a number (including the opening and closing bracket of that group) Guess I am doing something wrong somewhere? Answer Try this one instead: It matches a
Regex match first character once, followed by repetitive matching until end
I’m trying to match characters that shouldn’t be allowed in a username string to then be replaced. Anything outside this range should match first character [a-zA-Z] <– restricting the first character is causing problems and I don’t know how to fix it And then match everything else outside this range [0-9a-zA-Z_.] <—- repeat until the end of the string Matches:
How can I select expressions that cannot be a member of a group and are not empty in regex for markdown?
I’m trying to do a customized markdown. I am also using katex with the $ … $ group. But when replacing expressions, if they are in the $ … $ group, I have to not replace these expressions. EXAMPLE : Lorem **Ipsum**(1) is *simply*(2) dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy
Can this do-able using regular expressions patterns (capture groups)?
In JS, I have a set of strings that need to break down into an array. Each string can be breakdown up to 5 groups (Some have less). I’m using regex to break all. In the below string sets if it includes aa bb orcc it needs to go into the capture group2. Im not very familiar with regex unfortunately
JsFiddle URL with trailing slash being evaluated as correct link
I wrote a small method that evaluates JSFiddle snippet URLs. A valid JSFiddle snippet URL looks like this: https://jsfiddle.net/BideoWego/y200sqpr/ or https://jsfiddle.net/BideoWego/y200sqpr. An invalid URL is anything else. It seems to work well, but for some strange reason it evaluates https://jsfiddle.net/BideoWego/ to true. How can I fix this. Answer My solution is if the last character is / then remove it