Regular expressions (often shortened to "regex") are a declarative language used for pattern matching within strings. Please also include a tag specifying the programming language or tool you are using.
0
votes
4answers
42 views
A regex to match Strings contained after “:”
I need to use scan.useDelimiter() to recognize Strings taking place after ":".
I am making a Scanner that takes the following line from a list of similar entries.
c : 20002 : The Dragon : ...
0
votes
2answers
31 views
Apostrophe as part of a word with regexp in MATLAB
I am working on something in MATLAB that processes text. For this I need my regular expression to work properly.
So far I have this regexp below, which works for almost everything, but I would like ...
0
votes
0answers
9 views
Break down text file in bash
I have a text file in the following format:
variableStep chrom=chr1 span=10
10161 1
10171 1
10181 2
10191 2
10201 2
10211 2
10221 2
10231 2
10241 2
10251 1
variableStep ...
-1
votes
1answer
35 views
perl regexp with sas - exact match one or the other
I need to extract numbers written in words or in figures in a text.
I have a table that looks like that,
1 ... 1 child ...
2 ... three children ...
3 ...four children ...
4 ...2 children...
...
0
votes
4answers
18 views
R grepl to find a pure number
Probably a very basic question but its buggging me that i can't easily find a solution...so i thought i should come to the wisdom of the SO wise ones...
I would like to be able to return a TRUE or ...
0
votes
2answers
39 views
Javascript regex to match last word regardless of specials characters
We use this script to alter the last word in a sentence.
$div = $('.cPageHeader h2');
$div.html($div.text().replace(/(\w+?)$/, '<span class="cOrange">$1</span>'));
This works well as ...
2
votes
8answers
2k views
Best Strategies for preventing addresses with PO Boxes?
I have a client which is shipping via UPS, and therefore cannot deliver to Post Office boxes. I would like to be able to validate customer address fields in order to prevent them from entering ...
0
votes
1answer
8 views
Issues with using Custom iterators for regex_iterator
I want to do regex search on a text where I want to skip certain characters from the text. Original question asked here : Regular Expression library that maintains state, takes input character by ...
1
vote
1answer
24 views
preg_replace doesn't accept unicode
I'm trying to maintain only valid characters and Hebrew Unicode characters from a string using preg_replace.
I'm getting an error on this string:
$PLAINText1 = ...
5
votes
2answers
6k views
Using match to find substrings in strings with only bash
Although I am almost sure this has been covered, I can't seem to find anything specific to this. As I continue my journey on learning bash I keep finding parts where I am baffled as to why things ...
2
votes
2answers
3k views
How to Specify single quote in regular expression
Here is my regular expression . I want to include single quotes (') within the characters such as (O'Neal Nickel). Here is my regular expression allowing letters and spaces and full stops(.) and (-) ...
0
votes
0answers
13 views
get specific string after first occurance of string regex sublime text 2 find & replace
include_once($pathToRoot.'header.php');
echo('</div>');
assume you have variations on the above code across hundreds of files, how do you match against the first occurrence of
</div>
...
0
votes
4answers
36 views
Regex to check if a single quote is preceeded by another single quote
I would like to write a regex to validate if a single quote is preceeded by another single quote.
Valid strings:
azerty''uiop
aze''rty''uiop
''azertyuiop
azerty''uiop''
azerty ''uiop''
...
1
vote
1answer
11 views
boost regex smatch in recursive function behaves like a static variable
I encountered a strange behavior using boost::regex.
The following function calls itself once (if invoked with argument 'true').
void regex_rek(bool recurse)
{
boost::smatch match;
if ( recurse ...
0
votes
4answers
35 views
Python: check if any word in a list of words matches any pattern in a list of regular expression patterns
I have a long list of words and regular expression patterns in a .txt file, which I read in like this:
with open(fileName, "r") as f1:
pattern_list = f1.read().split('\n')
for illustration, the ...