All Questions
Tagged with regex javascript
149 questions
3
votes
1
answer
163
views
Bulk Text Replacer
I have created a simple text editor with a "replace all" feature. It's meant to be part of a larger project, so it needs to be robust and work reliably across various scenarios. Please ...
2
votes
2
answers
151
views
Faster regex to match all worded numbers from 1 to 99
I would like to know if there is a better regex to match all worded numbers from 1 to 99.
With "better" I mean shorter with same performance, OR faster.
I came up with this. I can't do ...
2
votes
1
answer
84
views
Combining multiple regexps using the `|` operator and grouping the regexps by their flags
I've implemented a function that creates a multiple regular expressions predicate. The idea behind the predicate is combining regular expressions using the disjunction operator ...
6
votes
1
answer
1k
views
Username Validation RegExp
Working through the freeCodeCamp JavaScript curriculum and I found this RegExp task surprisingly tricky (maybe I just don't use RegExp very much).
The parameters are:
Usernames can only use alpha-...
0
votes
1
answer
617
views
Using a RegEx to create a UUID string
I'm writing a Discord bot that sometimes requires a Minecraft account UUID to be looked up so this is the function (and MWE) I have written to do this.
...
3
votes
1
answer
214
views
Remove unwanted characters at the end of a string
I want to make this code better , its works now, but i think it can be better , i have a hook and one property is onChange that get value and can setState and return that value for value of input , in ...
0
votes
2
answers
86
views
Test strings with a lot of regular expressions
I've a list of strings and a list of regular expressions. I need to categorize each string to get what type of string it is based on regex.
This is my code:
...
1
vote
1
answer
3k
views
Regex detect URL without http(s):// and www
I want to locate urls without protocols in the text, and then add the protocol before them. This means I don't want urls that begin with http(s):// or ...
1
vote
1
answer
2k
views
simplifying regex expression for timestamp
I was wondering if it's possible to simplify this regex string (JS):
...
2
votes
3
answers
287
views
regex check variable amount of digits
Check for Expiry
Expiry can go from 1 to 299
Expiry can be 1 digit, 2 digits or 3 digits
This will be the Input I check my regExp against.
...
7
votes
3
answers
289
views
parse date and number from API results
I'm slurping up fields from an API that returns an array of fields. Each field in the array is a String that actually contains two separate fields (a number and a date). The number is enclosed in ...
4
votes
2
answers
4k
views
Regular expression to get a string between two strings where the last string can also be 'end of string'
I intend to extract a URL search parameter value using a regular expression in plain javascript. The parameter can be in any order in the search query.
So is there a better approach than 👇?
...
4
votes
1
answer
476
views
Check whether '.' and '/' are escaped properly
I'm currently using a function to check if a URL has correctly escaped two different characters: . and /.
To escape a character ...
9
votes
2
answers
362
views
Follow-up: Javascript Syntax-Highlighter for Java
Background
The basics of this project have already been discussed here.
I've improved the following things:
Sᴀᴍ Onᴇᴌᴀ mentioned that I shouldn't use multiple elements with the same id. I corrected ...
3
votes
1
answer
660
views
Tampermonkey script to check and replace youtube's subscriptions to show all videos
Just wanted a general review of the code to make sure I'm doing it properly/efficently. New to JS and don't use RegEx too often.
...