regex Questions
5
Solved
Morning SO. I'm trying to determine whether or not a string contains a list of specific characters.
I know i should be using preg_match for this, but my regex knowledge is woeful and i have been u...
4
The regex should match valid dates in a string in the format YYYYMMDD. For example, aaa_20150327_bbb should be matched but aaa_20150229_bbb not because 2015 is not a leap year.
Only year from 2000...
Galeiform asked 27/3, 2015 at 18:30
7
Solved
I'm performing a regular expression match on a column of type character varying(256) in PostgreSQL 8.3.3. The column currently has no indices. I'd like to improve the performance of this query if I...
Saadi asked 30/3, 2009 at 20:56
1
Solved
The following one-line script is to rename files from e.g. Foo_Bar_Baz.txt to Baz_Bar_Foo.txt:
(rename is the rename(1) utility from File::Rename.)
rename -n 's/(\w+)_(\w+)_(\w+)/join "_"...
1
Solved
For the sake of description, I provide a minimal reproduction of the following code:
#include <bits/stdc++.h>
#include <iostream>
#include <regex>
#include <string>
#include...
4
Solved
When using Regex in Python, it's easy to use brackets to represent a range of characters a-z, but this doesn't seem to be working for other languages, like Arabic:
import re
pattern = '[ي-ا]'
p = ...
Incipient asked 29/12, 2014 at 9:1
3
Solved
I'm trying to remove parenthesis and text within it.
Eg: Column1 has data and cleaned data should look like column2
Column1 Column2
HF(abcd) HF
BP(234) BP
ATRS (2354) ATRS
AB(PS) SD(12) AB SD
I...
Farmland asked 2/10, 2017 at 18:44
3
Solved
I have a dataframe:
mydf <- data.frame(
col1 = c("54", "abc", "123", "54 abc", "zzz", "a", "99"),
col2 = c("100"...
6
Solved
I came across the regular expression not containing 101 as follows:
0∗1∗0∗+(1+00+000)∗+(0+1+0+)∗
I was unable to understand how the author come up with this regex. So I just thought of s...
Gereron asked 17/1, 2016 at 9:9
3
Solved
My question is pretty straightforward, using only a regular expression find and replace, is it possible to keep the case of the original words.
So if I have the string: "Pretty pretty is so pretty...
Ob asked 17/3, 2015 at 16:50
4
Solved
I am using webpack which takes regular expressions to feed files into loaders. I want to exclude test files from build, and the test files end with .test.js. So, I am looking for a regular expressi...
Narial asked 11/2, 2017 at 13:42
5
Suppose I have several strings: str1 and str2 and str3.
How to find lines that have all the strings?
How to find lines that can have any of them?
And how to find lines that have str1 and either o...
11
Solved
What is the proper syntax for a method that checks a string for a pattern, and returns true or false if the regex matches?
Basic idea:
def has_regex?(string)
pattern = /something/i
return strin...
3
Solved
Examples:
For 0123123123, 1 should be matched since the 2nd 1 appears before the repetition of any other digit.
For 01234554321, 5 should be matched since the 2nd 5 appears before the repetition o...
3
Solved
If I have a list with following elements
list[0] = "blach blah blah"
list[1] = "SELECT something"
list[2] = "some more text"
list[3] = "some more text"
How can I find the index of where the stri...
1
Solved
This it taken from the "awk-exercises".
For the input file patterns.txt, filter lines containing three or more
occurrences of "ar" and replace the last but second "ar"...
2
Solved
I need to get dynamically the current directory in which my .htaccess file is located. Is that possible ? (A variable maybe ?).
Something like : %{SCRIPT_FILENAME}
Thank you in advance.
EDIT : I...
Prussia asked 4/3, 2013 at 10:45
3
Solved
What is a correct regex for matching semantic versioning?
It should not match for instance
01.1.1
9.8.7-whatever+meta+meta
1.2.3.DEV
1.2.3-0123
1.0.0-alpha_beta
1.2-SNAPSHOT
1.2.31.2.3----RC-SNAPSH...
Fasciculus asked 7/7, 2022 at 15:11
11
Solved
We've got such regexp:
var regexp = /^one (two)+ three/;
So only string like "one two three" or "one two three four" or "one twotwo three" etc. will match it.
However, if we've got string like
...
Odoric asked 18/3, 2014 at 15:3
8
Solved
I have the current regular expression:
/(?<=[\s>]|^)#(\w*[A-Za-z_]+\w*)/g
Which I'm testing against the string:
Here's a #hashtag and here is #not_a_tag; which should be different. Also t...
6
I am started with nestjs recently and i want apply a middleware for all routes, except the auth route.
In the documentation it says that I can add all the controllers or paths of the routes where ...
Selfconscious asked 11/4, 2020 at 6:36
2
Solved
Is it possible to use a regex for parsing an argument? For example, I want to accept an argument if only it is a 32 length hex (i.e. matches /[a-f0-9A-F]{32}/)
I tried
p.add_argument('hex', type=st...
3
Is it possible to use regex global g flag in java pattern ?
I tried with final Pattern pattern = Pattern.compile(regex,Pattern.DOTALL);
but it do not behave like global flag.
Do we have any worka...
Throckmorton asked 4/8, 2018 at 16:56
15
Solved
I'm needing to write some regex that takes a number and removes any trailing zeros after a decimal point. The language is Actionscript 3. So I would like to write:
var result:String = theStringOfT...
Rickettsia asked 10/10, 2014 at 12:11
11
Solved
I am currently looking for a regex that can help validate a file path e.g.:
C:\test\test2\test.exe
© 2022 - 2024 — McMap. All rights reserved.