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
Related
This question already has an answer here:
Regex match strings between asterisks
(1 answer)
Closed 2 years ago.
Is it possible to do a RegEx to only match the last asterisk right before and first asterisk right after an value?
Value: **example**
My actual regex: /\*(.*?)\*/g
My actual regex matches the two asterisks before and after word example, but i want to do a regex that only matches the last asterisk right before and the first asterisk right after the word.
Thank you!
try /[*][^*]+[*]/gm
Works as tested on regex101.com
This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 2 years ago.
Good morning,
Could tou please help on this regular expression request.
I would like all characters before "-", but only if that chain has a lenght of 7 characters
If 5QHTN33-48314742, result 5QHTN33. But if AAA5QHTN33-48314742, then no result.
Thanks for your help.
as '^' refers to start of line and '$' refers to end of line, I highly prefer to say you have to split the line with spaces(regex of split: (\s+) , for java: (\\s+)) so you can use below regex after splitting and use it on every element, hope to be helpful:
(^)((?<word>[\w\W]{7})\-.+)($)
Explanation
(?<word>[\w\W]{7}) will capture your word into a group with name word ,so you can get it easier.
This question already has answers here:
Regex: matching up to the first occurrence of a character
(14 answers)
Closed 4 years ago.
can someone please quickly help me with regularexpression to match any character and group it which is coming behind front shash:
ae-app001/UK/Server/company
in this i want to match ae-app001 only.
the format remains the same except that we dont know how many slash might be there,
sometimes the string might be just :
ae-app001/UK/Server
so i need a generic regex which will match string1 in the below:
string1/string2/string3/string4
string1/string2/string3
etc..
/^([^\/]+)/ Demo
But what if there's no slashes? Is it ok to capture whole string?
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 \:
\[
\]
This question already has answers here:
Regex match entire words only
(7 answers)
Closed 7 years ago.
var text = 'word otherword';
I want to select words that only matches with 'word'. When i use simply /word/ for regex pattern, then it also selects the 'word' part in 'otherword'. I dont need that word(in this case 'otherword').So how can i only select/match 'word' word using regex?
Use word boundary - \b.
/\bword\b/