This question already has answers here:
What's the regular expression that matches a square bracket?
(10 answers)
Closed 6 years ago.
I want to allow [] these brackets in a name field using regex. Please help me on this.
Just escape them using \:
\[
\]
Related
This question already has answers here:
Regex that matches anything except for all whitespace
(5 answers)
Closed 2 years ago.
I'm using a regular expression to match Facebook url.
((http|https)://)?(www[.])?facebook.com/.+
It accepts:
facebook.com/xxxxx
www.facebook.com/xxxxx
http://facebook.com/xxxxx
https://facebook.com/xxxxx
But it still accepts whitespaces after /:
facebook.com/(spaces there)
How can I prevent it?
You can shorten the pattern by making the s optional in https using a quesion mark, and use \S+ to match 1 or more non whitespace characters instead of .+ which can also match spaces.
(?:https?://)?(?:www\.)?facebook\.com/\S+
Regex demo
This question already has answers here:
Regex: ignore case sensitivity
(15 answers)
Closed 2 years ago.
Any ideas why this regex doesn't match everything from my string? (I want it to match discord.gg/XUGswJ)
[a-z] means lowercase letters. You probably want [a-zA-Z] to include uppercase.
This question already has answers here:
What special characters must be escaped in regular expressions?
(13 answers)
Closed 5 years ago.
I would like to find dots/punctuations not surrounded by any numerics or alphanumerics (in other words surrounded by nothing) and replace these with nothing using Notepad++ and regex.
I tried using
(?<![a-zA-Z0-9]).(?![a-zA-Z0-9])
but it replaces all the numbers surrounding each dot with nothing.
How can this expression be adjusted appropiately for use in Notepad++ ?
You need to escape the . character:
(?<![a-zA-Z0-9])\.(?![a-zA-Z0-9])
This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 5 years ago.
I need to remove text between the character ? and linebreak; and if it's possisble for the question mark, to be removed as well.
You shold achieve this with a simple (.*\?).+$, replacing this for $1. The dollar matches the end of line when using the multi line matching.
Live demo
This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 6 years ago.
I have tried to match <b> using regular expressions.
the pattern /<.>/ matches <b> but the pattern /<[.]>/ does not match.
What is the difference between /<.>/ and /<[.]>/ in regular expressions
When you put dot inside [] it is a literal dot, not a any character.
So the /<[.]>/ matches only <.>. It is the same as escaping a dot: \. in regexp.