logo
down
shadow

REGEX QUESTIONS

Regex vs brute-force for small strings
Regex vs brute-force for small strings
I wish this helpful for you I've written a small benchmark to estimate the performance of the: NOP method (to get an idea of the baseline iteration speed); Original method, as provided by the OP ; RegExp; Compiled Regexp; The version provided by @mar
TAG : regex
Date : November 19 2020, 11:01 PM , By : BobbyMcG
Given a string, how to remove the run of the first character? (sed)
Given a string, how to remove the run of the first character? (sed)
it helps some times I need a sed command that takes a string and removes all copies of the first character from the beginning (but not from the rest of the string). , You can use:
TAG : regex
Date : November 19 2020, 11:01 PM , By : sh0uter
Regex. Specify that a character can't be there
Regex. Specify that a character can't be there
fixed the issue. Will look into that further I want to recognice a code line and my problem is with the start of a code line. I don't know how to make my regex recognice when a instruction is next to something that is not part of the instruction. , P
TAG : regex
Date : November 19 2020, 11:01 PM , By : bambal
Replace Specified String And All Subsequent Characters
Replace Specified String And All Subsequent Characters
will be helpful for those in need I just figured out the answer, my regular expression was wrong. I needed to add the .* to the end of the specific keyword like this:
TAG : regex
Date : November 18 2020, 11:01 PM , By : user135995
Notepad++ delete all text except URL
Notepad++ delete all text except URL
it helps some times You could use the replace function (CTRL+H) in Notepad++ and a regular expression like this:
TAG : regex
Date : November 18 2020, 11:01 PM , By : Tom Bartolucci
add number as prefix
add number as prefix
Hope that helps Find all two digits and capture them (with parentheses).\b(\d\d)\b
TAG : regex
Date : November 17 2020, 11:01 PM , By : Qassem Tamimi
RegExp how to deal with RegExp When you call the construcor?
RegExp how to deal with RegExp When you call the construcor?
I hope this helps you . The RegExp class lets you work with regular expressions, which are patterns that you can use to perform searches in strings and to replace text in strings. You can create a new RegExp object by using the new RegExp() construct
TAG : regex
Date : November 17 2020, 11:01 PM , By : Josué Santos
regex capturing to start at \b or end of (www\.)
regex capturing to start at \b or end of (www\.)
help you fix your problem The problem with www. being included in the match seems to be because you're using the 0th group (which is the full match, not just the capturing groups). While I don't know how to change that, it is possible to reformulate
TAG : regex
Date : November 17 2020, 11:01 PM , By : Tom
sed regex with alternative on Solaris doesn't work
sed regex with alternative on Solaris doesn't work
wish helps you Currently I'm trying to use sed with regex on Solaris but it doesn't work. I need to show only lines matching to my regex. , With Perl
TAG : regex
Date : November 16 2020, 11:00 PM , By : Don Detroit Carey Sr
proper syntax for splitting large mp3 files into several
proper syntax for splitting large mp3 files into several
wish helps you I can split one large mp3 file into several files based on silence using the mp3split command / program below , You need to set the -o (output format) option.
TAG : regex
Date : November 16 2020, 11:00 PM , By : Karen Furnass
URL regex: required protocol and optional www
URL regex: required protocol and optional www
I wish this helpful for you Should pass:
TAG : regex
Date : November 16 2020, 11:00 PM , By : Daniel Moore
Bash Regular Expression Matching
Bash Regular Expression Matching
wish helps you The part after %% isn't a regex but a glob pattern (the things you use for filenames, like *.jpg).You can do this with bash's extended glob patterns. To enable them, you have to put shopt -s extglob at the beginning of your script. Her
TAG : regex
Date : November 15 2020, 11:01 PM , By : Sydney Fox
Not able to extract with grep
Not able to extract with grep
around this issue (As has been said many times before, the best solution is to use an HTML parser.)With GNU grep, try this simplified version:
TAG : regex
Date : November 14 2020, 11:01 PM , By : JeongSoo Ha
[Regex]How to get numbers without letter before
[Regex]How to get numbers without letter before
hop of those help? \d+ is part of the story; what you need is a condition on the prefix, a look-behind, to require that the character before the match is not a letter:
TAG : regex
Date : November 13 2020, 11:01 PM , By : Fabian
Adding quotes to a CSV using perl
Adding quotes to a CSV using perl
I hope this helps . I recommend not reinventing the wheel, but rather to use an already existing module, as zdim recommends. Here is your example using Text::CSV_XStest.pl
TAG : regex
Date : November 11 2020, 11:01 PM , By : Holex
Bash Parameter Expansion - match up to but not including regex
Bash Parameter Expansion - match up to but not including regex
hope this fix your issue I want to match up to but not including a given string. So in a text like , To remove everything after first matching digit:
TAG : regex
Date : November 11 2020, 11:01 PM , By : mir4ef
How to set regex for lines that don't start with '/' and end with ',' or '.' or '+'?
How to set regex for lines that don't start with '/' and end with ',' or '.' or '+'?
I wish did fix the issue. The only way to do this with one single regex will be to use a negative lookbehind. However, you would end up with a regex that starts with ^(?That means the only way that actually works is to use multiple regexes.
TAG : regex
Date : November 10 2020, 11:01 PM , By : Alexandre Wahl
Is it possible to perform all these string validations in a single regexp?
Is it possible to perform all these string validations in a single regexp?
This might help you It's possible, but it would be ugly. A single regexp would have to contain 24 subexpressions of the form [0-9].*[a-z].*[A-Z].*\W to match each of the possible orders in which the four required character types could occur. The way
TAG : regex
Date : November 10 2020, 11:01 PM , By : Jose Ramon Macias
Extract text between the two anchor tags using sed, grep or awk
Extract text between the two anchor tags using sed, grep or awk
To fix the issue you can do As Sundeep notes in a comment: best to use a proper HTML parser.The standard utilities are mostly line-based and deal poorly with quoting; they are ill-equipped to robustly parse HTML, with all its variability around quoti
TAG : regex
Date : November 10 2020, 11:01 PM , By : air
htaccess to nginx rewrite rules
htaccess to nginx rewrite rules
Hope that helps I've recently moved from an Apache to a Nginx webserver, however a script seems to have issues due to rewrite rules that are not properly working. , These rewrites should work:
TAG : regex
Date : November 07 2020, 11:01 PM , By : Baji. D
I want a regex for this?
I want a regex for this?
it fixes the issue I am not an expert at regex. I want a regex for following requirements , Omg, this is horrbile... I think, this one will do:
TAG : regex
Date : November 04 2020, 11:01 PM , By : Rahul Bhamare
egrep \b not recognising single quote
egrep \b not recognising single quote
This might help you If there are multiple words per line then you cannot use anchors.If your grep supports -P (PCRE) option then you can use lookahead regex:
TAG : regex
Date : November 04 2020, 11:01 PM , By : Chen
Knockout-Validation Using Regular Expression to Validate a password
Knockout-Validation Using Regular Expression to Validate a password
may help you . Ive been wracking my head trying to get Knockout validation to do for password with at least 1 letter and least 1 number. Heres the code I think came closes with but still rule always fails.
TAG : regex
Date : November 03 2020, 11:01 PM , By : swetha vulisetty
Find specific expression between construction
Find specific expression between construction
this one helps. You can make use of \K (match reset) and \G (continous matching) to achieve this. With (?:alt="|(?!^)\G)[^"-]+\K- you can find all the dashes and then simply replace by .
TAG : regex
Date : November 03 2020, 11:01 PM , By : deddy
Extract text using word VBA regex then save to a variable as string
Extract text using word VBA regex then save to a variable as string
hope this fix your issue Try this:You can find documentation for the RegExp class here.
TAG : regex
Date : November 02 2020, 11:01 PM , By : Brent
Linux console perl replace not working on large file
Linux console perl replace not working on large file
wish of those help After trying everything, I found out that in the original file the pattern was:
TAG : regex
Date : November 02 2020, 11:01 PM , By : a.anu
Python 3 . When searching txt file - -aim to also get title as well as searched text
Python 3 . When searching txt file - -aim to also get title as well as searched text
I wish did fix the issue. Just a question on thefollowing bit of code I am using -- Works perfect but hoping to get more information when getting results , You can memorise last title:
TAG : regex
Date : October 31 2020, 05:38 PM , By : Arabella John
How to match all for a second pattern that follows a particular pattern only?
How to match all for a second pattern that follows a particular pattern only?
hope this fix your issue Using pcre, I would like to replace all the foo with bar only on the lines that starts with foobar? , You may combine \K with a \G operator in a regex:
TAG : regex
Date : October 31 2020, 05:38 PM , By : Sheshaw Naser
Regex pattern validation Angularjs2
Regex pattern validation Angularjs2
will help you I'm developing an Angular2 application. I'm trying to do a validation when login using a regex pattern. , You need to change to:
TAG : regex
Date : October 31 2020, 05:38 PM , By : Борис Осянин
Can you explain what this regex does in ksh?
Can you explain what this regex does in ksh?
like below fixes the issue This consists in two grep expressions, so let's check one after the other: grep -i "^--[ ]*dependency"
TAG : regex
Date : October 31 2020, 09:54 AM , By : Alicia Pascual
Replace line after match using sed or regex
Replace line after match using sed or regex
This might help you I need to replace several variables with new values: , Ok, finally figured out. The following line works as expected:
TAG : regex
Date : October 31 2020, 09:54 AM , By : Marko
pattens in regexNER in core-nlp
pattens in regexNER in core-nlp
this one helps. The anchors are redundant, they actually prevent the pattern from matching because ^ matches a string start location and $ matches the string end location.Since you need to have access to the part after _, you need to also capture, so
TAG : regex
Date : October 31 2020, 05:55 AM , By : Zaki Nijem
Need some help on url-rewriting (htaccess)
Need some help on url-rewriting (htaccess)
seems to work fine I need some help to rewrite my URLs. I'm stuck on a pretty simple thing but regex gives me headache. So, my website is working on an "index.php" file at its root, this index calls the pages specified in parameters. , Try it like th
TAG : regex
Date : October 31 2020, 05:55 AM , By : Anthony
How to match all <li> elements of an html code
How to match all <li> elements of an html code
I wish this help you As Tushar and Michał M suggested I missed the newline .Tushar's suggestion worked as expected
TAG : regex
Date : October 31 2020, 12:01 AM , By : Tofu King
Remove subfolder from URL
Remove subfolder from URL
I hope this helps . I'm going to create pretty links in URL-address. , Have your rules like this:
TAG : regex
Date : October 31 2020, 12:01 AM , By : Kyle
Reduce number of white spaces
Reduce number of white spaces
I wish this help you I need to reduce number of white spaces in large number of files. For example: , in notepad++
TAG : regex
Date : October 30 2020, 12:01 AM , By : Anatoliy Schavelev
Strange behavior of regex
Strange behavior of regex
should help you out The wrong capturing is accounted for by the fact that your patterns inside capturing groups (-?\+?\d*.?\d*) can match an empty string and - more importantly here - . matches any char, not only a dot. You must escape it to match a
TAG : regex
Date : October 26 2020, 11:56 AM , By : Mandeep Singh
Regex get the text before the ? but after underscore
Regex get the text before the ? but after underscore
will help you Note that ^(.+?)\? pattern matches any 1 or more chars up to the first (leftmost) occurrence of the ? char from the start of the string.You seem to want to get the last alphanumeric part from the last _ up to the ? char.
TAG : regex
Date : October 25 2020, 04:08 PM , By : Vaishali Rohankar
PowerShell: Delete similar lines from file
PowerShell: Delete similar lines from file
I hope this helps you . Loop over the text-file via Get-Content, separate the columns 'Value' ; 'Attribute' through string operations, and then use a hashmap in order to check whether you already processed a similar line -- if not, output the line on
TAG : regex
Date : October 25 2020, 04:08 PM , By : Carlos R.Abujas
Start matching specific whole words after the first four characters are typed
Start matching specific whole words after the first four characters are typed
wish helps you Use nested optional groups. Note you may also shortne the boundary patterns by replacing (?:^|(?
TAG : regex
Date : October 24 2020, 03:08 PM , By : narcisv
RegEx: How to exclude the first two characters from selection
RegEx: How to exclude the first two characters from selection
around this issue The dot and spaces are matched because your lookahead pattern does not match only up to the dot. To make sure your match does not start with . + space(s), you may consume them if they are present. An optional non-capturing group is
TAG : regex
Date : October 24 2020, 03:08 PM , By : DaXing
journalctl to search metadata with regex
journalctl to search metadata with regex
I hope this helps . journalctl does not accept patterns for anything other than unit names (in the -u argument). Depending on your needs, you could perform some filtering using JSON output and grep, as in:
TAG : regex
Date : October 22 2020, 03:08 PM , By : Raja
Why does this regex pattern fail to match the string
Why does this regex pattern fail to match the string
may help you . By copying your regex from your post, I saw there's a redundant space here:
TAG : regex
Date : October 22 2020, 01:08 AM , By : Mohi
What does s/(\W)/\\$1/g do in perl?
What does s/(\W)/\\$1/g do in perl?
Hope that helps It puts backslashes in front of non-word characters. Things like "untitled file" becomes "untitled\ file".As in most regular expression operations $1 represents the first thing captured with (...) which in this case is the (\W) repres
TAG : regex
Date : October 21 2020, 01:08 AM , By : MANJUNATHA C
Match and split by regular expression from start of string
Match and split by regular expression from start of string
will help you It turns out the problem I was having was indeed with my pattern matching. I was attempting to match on (list (cons 0 x) ...), but the documentation implies that will only match a list of one-or-more elements of (0 . x) (where x is arbi
TAG : regex
Date : October 21 2020, 01:08 AM , By : Manÿam Raja Shekhar
VSCode Search and Replace Regex
VSCode Search and Replace Regex
wish help you to fix your issue You'll need to use .+? instead of * here since this uses regular expressions.In regular expressions a dot . means "any character", the plus + means "one or more times", and the question mark ? after this means "try to
TAG : regex
Date : October 20 2020, 03:08 PM , By : clover mamitag
Sublime Regex: Add digit to end of search group
Sublime Regex: Add digit to end of search group
I hope this helps . There are several ways to get your desired result.You may use a POSIX like replacement backreference \1 to insert Group 1 value and since there can be only 9 such backreferences, \11 is parsed as backreference to Group 1 and a 1.
TAG : regex
Date : October 20 2020, 03:08 PM , By : Jason Sui
perl to generate string to match regex
perl to generate string to match regex
Any of those help If you want a general solution and you aren't will to work towards fixing String::Random, you could use a large number of monkeys.
TAG : regex
Date : October 19 2020, 03:08 PM , By : JPeter
Regex Match % but not \%
Regex Match % but not \%
will help you I'm struggling to find the right regex for the case where I want to match a '%' but only if it's not preceded by a '\' between quotations.
TAG : regex
Date : October 19 2020, 03:08 PM , By : Thomas Waldbillig
scala - regular expression
scala - regular expression
this will help I am new to scala. I am not new to regular expression, but scala's regular expression is a bit confusing to me. For example, my input variable is string from the "DEVICE" column
TAG : regex
Date : October 16 2020, 03:08 PM , By : Mike Y
Find and Replace Specific characters in a variable with sed
Find and Replace Specific characters in a variable with sed
I hope this helps you . There may be more efficient ways, (only 1 s/s/r/ with a fancier reg-ex), but this works, given your sample input
TAG : regex
Date : October 15 2020, 03:08 PM , By : Matt Culliton
request handlers using webapp2 tuple(regex, handler)
request handlers using webapp2 tuple(regex, handler)
this one helps. You can always do a tryout using a generic approach in the handler's get() code (whcih you can easily check with your browser), in the sense that it should work regardless of the regex pattern you have in the app's router:
TAG : regex
Date : October 15 2020, 03:08 PM , By : pranav ghodake
Find all lines using regular expression
Find all lines using regular expression
Any of those help The issue can be "debugged" with a slightly modified pattern, ^(.*?)\b(max\d+)?\b(.*?)$, with the rest of the pattern wrapped into separate capturing groups. You can see that the lines are all matched by the Group 3 pattern, the las
TAG : regex
Date : October 14 2020, 09:34 AM , By : Lina Arcos
perl to check if sequence contains at least 3 unique bases and if not delete
perl to check if sequence contains at least 3 unique bases and if not delete
this one helps. I have a fasta file. I need to remove sequences containing “N” or did not contain at least 3 unique bases. The code so far is below. Also how would I remove the sequence ID line as go along for sequences I delete.
TAG : regex
Date : October 14 2020, 09:25 AM , By : nickg902
shadow
Privacy Policy - Terms - Contact Us © soohba.com