Regular expressions (often shortened to "regex") are expressions written in a declarative language used for matching patterns within strings. General reference: http://stackoverflow.com/q/22937618 Remember to include a tag specifying the programming language or tool you are using.

learn more… | top users | synonyms (8)

0
votes
0answers
6 views

match <U+FEFF> in Java

I am trying to use Java find those lines in a file that start with . My regular expression '^\\ufeff{2}.*' doesn't match anything, even though I can see lines with the specified format. How can I ...
-1
votes
1answer
17 views

python regex sub without order

I have following string "3 0ABC, mNone\n" and I want to remove m None and \n. The catch is that 'm', \n and None can be anywhere in the string in any order. I would appreciate any help. I can do ...
0
votes
0answers
15 views

Optimization of regular expression for custom key-value pairs

I am trying to extract some key-value pairs plus their preceding text from a large file, but the regular expression used runs very slowly, so it needs optimization. The input consists of fairly short ...
0
votes
1answer
23 views

Match for multiple lines of text between delimiters in Java

How can I match multiple lines of text between delimiters in Java? Question best explained by an example: ... unimportant text EndOfEntry Key=Value unimportant text maybe a few lines of unimportant ...
0
votes
3answers
13 views

Perl Regex vs Parsing

So I'm writing a static validator for a particular kind of file. These files are expected to have a certain JSON-like object in it. Sample below theObject = { key1 = value1, key2 = value2, key3 = { ...
0
votes
1answer
14 views

Write Folder Contents to CSV with Regex

I am trying to use the Python script here for my own purposes. I'm no Python bloke, so hopefully someone can see what I have wrong. The below script doesn't error out. My CSV is created with no ...
0
votes
0answers
16 views

'Looping' Through a Repeating Substring with Regex

The general problem: I've got lot of data I'm trying to clean up then parse. Each line is really long, but they all have the same structure. It starts with one unique substring, followed by a second ...
1
vote
2answers
24 views

Modifying lines in a file selected by their position relative to a marker

I am stuck at one point in my code and need some help. I have a file which looks something like this: some lines some lines LABEL: NOP ABC some text - line 1 NOP ABC some text - line 2 NOP ABC some ...
0
votes
3answers
21 views

Python regex swallows one character upon new line substituion

I am trying to understand what is wrong with my python regex. Task: I have the following text. This is a red fox\LF that chases a cat.\LF \LF The dog barks. I need to correct the first sentence by ...
0
votes
2answers
9 views

How to use find and replace wildcards in SSMS?

So I have something like: Price1 Price2 Price3 And I'd like to do a Find and Replace on them so the end result is this: COALESCE(Price1, 0) COALESCE(Price2, 0) COALESCE(Price3, 0) I tried using ...
0
votes
4answers
34 views

Having difficulties with regex

Here is a string: 111A9d809d4712701eea0e9c2b2c143941ab000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The 9d809d4712701eea0e9c2b2c143941ab is what changes every time but the 111A and the 000 never change, ...
0
votes
3answers
36 views

Regex not validating correctly

So i have spent the last hour or so trying to construct a regex pattern that follows these rules: Must be between 3-15 characters long Must start and end with a letter Can contain spaces and ...
0
votes
0answers
5 views

Nginx named capture and rewrite path

I have the follow URL: /uM_c7cTEhJtNjEiNa3d2zwLsTaU=/300x200/smart/http:/static... jpg And I need to capture the the first and second group of two characters and apply a rewrite to match to the ...
0
votes
1answer
17 views

Check if postal code is in a range

this might be a dumb question but I'm new to iOS programming and I just couldn't think of anything. for my app I need to check if a certain postal code is in a range. It's easy to do for German or US ...
2
votes
2answers
28 views

How to match all of a function content in c with regex with least possible overhead

Say I would like to match all the content of a function foo() in several file to copy/paste them outside their original file using regex. For instance, having a function foo() as : (static void) ...
-4
votes
2answers
33 views

How to replace space with new line

I have a PHP variable which contains numbers separated by a space. I want to replace each space with a new line and then want to put those numbers into a list or HTML table. Here's an example string: ...
1
vote
3answers
51 views

Regular expression for a string that does not start with a /*

I use EditPad Pro text editor. I need read string into code, but I need to ignore ones that start with the label "/*" or tab + /*, for example: /** * Light up the dungeon using "claravoyance" * * ...
0
votes
0answers
8 views

QRegExp For QSortFilterProxyModel - Find All Items In A List

Am using PyQt & getting stuck on using setFilterRegExp() with a QSortFilterProxyModel. The source model outputs integers 1-30, and the QSFPM is to filter 1-30, leaving only the numbers in a ...
0
votes
1answer
22 views

Match string plus any non-whitespace character and insert whitespace

I'm trying to match and replace a string in a lot of files. String to search for: </ANON>[any non-whitespace char], e.g. "</ANON>." or "</ANON>)" I want to stick a whitespace in ...
-7
votes
1answer
39 views

How can I split a url in C# into a Key Value pair? [duplicate]

I have a Url: https://www.facebook.com/video.php?v=10154500552625464 that I need to split into a key value pair with: Value: https://www.facebook.com/video.php?v=10154500552625464 Key: ...
0
votes
2answers
21 views

jQuery phone number format check without validation plug-in

Does anyone know how to wring a simple US format phone number checker without using the validation plugin? So far I have something like this, but I can't seem to get it to work. ...
0
votes
0answers
5 views

Hide paypal express button when there is an if statement in cart.php (opencart)

I have file in module/pp_layout.tpl that has the following code in it, <a href="<?php echo $payment_url; ?>" title="PayPal Express Checkout" style="text-decoration:none;"> <?php ...
0
votes
2answers
34 views

Regex returning last character of string?

'Ello, so I'm using Rainmeter and I just want to get the last character of a string using Regex. Rainmeter uses Perl regex. The string is just two characters long, it's just minutes (so just two ...
0
votes
1answer
21 views

Regex: Why does /^((\d|-){5,10})/ match '20866 United States' with a match group of 6?

I was attempting to write a regex for certain zipcodes and noticed this oddity. Using /^((\d|-){5,10})/ on '20866 United States' yields the match groups: 1) 20866 2) 6 I don't understand the ...
0
votes
1answer
24 views

python web scraping inside html commets

the following is not necessarily a question. I created a little piece of code to extract data from a web page and I want to know what do you thing about the code and how to improve it. I need to ...
-1
votes
2answers
16 views

php regex find symbols in a string

How in a string -1 -2 -3 -4 get array(-1, -2, -3, -4) using regex and function preg_match_all Any help is appreciated! Thanks!
0
votes
3answers
19 views

How to replace strings in files but not match a string but not if it contains a substring in powershell? (regex)

In Powershell, I'm trying to replace connection string configurations, but need to do two different replaces. Specifically, I'm trying to replace the user id portion of the connection string but we ...
1
vote
1answer
18 views

How do I check UITextField values for specific types of characters e.g. Letters or Number?

What I want to do is set some boolean in the if statement below to true if anything other than letters, numbers, dashes and spaces is contained in the textField. Then for an email field check for a ...
0
votes
2answers
26 views

RegEx grouping not what expected

I have the following regex that should pull out 3 groups ^(ser-num.*|\[ser-num.*])(?: )?(\w+)?(?: )?(http://.*\.com/(?:s(?:erial)?|p(?:roduct)?)/\d+(?:/)?(?:\d+|(?:\w|-)+)?) These two strings: ...
1
vote
3answers
39 views

Regex to change all past a certain pattern to Uppercase

I have an xml file that has a value like JOBNAME="JBDSR14353_Some_other_Descriptor" I am looking for an expression that will go through the file and change all of the characters in the quotes to ...
-1
votes
1answer
41 views

Search Regex to match string

Hey im searching for a working regex for I tried something like this ^([-])?(([(])?[-|]{0}[a-zA-z0-9|]([)])?([.])?)+$ but it isn't very nice. It should match: world.block.(1-2|1).(test1|stack) ...
2
votes
1answer
35 views

Python regex Find All Numbers Between 6 or 7 Digits

I am using this regex using the re module in python and getting this result: In [156]: re.findall(r'.*\D(\d{6,7})\D.*', ' f123456 f1234567 ') Out[156]: ['1234567'] ...but I'm wanting this result: ...
-1
votes
1answer
23 views

Python writing to file errors expected string/buffer

I have a code which will replace specific text from keywords iteratively, Problem:When i provide a file as input i get error Coding:(works good when text is provided within code) import re, ...
1
vote
3answers
41 views

Can Regex Extract Multiple Numbers from String?

Let's say I have a string like: SORT_123_456 Is there an easy way to parse the two integer values? I do not know how many digits these values will have. It would also be helpful if I could ...
2
votes
1answer
28 views

preg_match “Text” “Mabye text” “Eight Numbers”

I'm new to preg and hope someone out there can help me. I need to be able to match a text and then the next 8 consecutive digitals. Eg. I got this string: $string = "Lorem ipsum dolor, consectetuer ...
0
votes
4answers
10 views

I need to match a URL with a forward slash, but skip the first match

I am new to regex so this may be easy. I need a regex to skip the first occurrence of a the forward slash in a URL, but match the entire string on all subsequent occurrences of the forward slash. ...
0
votes
1answer
16 views

Need a regex to remove outer function

I need to remove require.js from a bunch of files. The rest of the code needs to be preserved, and theres plently of nested functions, etc, which complicates things. I've pasted a sample below, ...
0
votes
0answers
23 views

Extract an array from one javascript file and write to another text file

I've a javascript file(gulp file), where I'm writing the name of javascript files to be minified. After minification I want to delete these original files while deployment. So say my gulp file is as ...
0
votes
5answers
28 views

Find and replace with keeping part of the string intact?

I managed to convert ' time into a pipe character going from this… 2014/12/04 Test in 1 day' time 0 weeks 2014/12/07 Amazon Prime Ends in 95 days' time 13 weeks 2014/12/24 Christmas in China in 112 ...
0
votes
0answers
11 views

changing regex “^[^<>]+$” by Html.Encode in ASP.net

I need to allow symbols < > but also prevent XSS atacks,so im trying to use HTML.Encode() method @Html.TextAreaFor(model => Model.Text, 15, 5, new { placeholder = ...
0
votes
2answers
44 views

Perl-regex word-boundary equivalence

Extending my basic regex knowledge, and some things are unclear for me. If the \b matches word boundary has the next two regexes the same meaning - e.g. will match the same strings? /\bword\b/ ...
2
votes
3answers
31 views

Extract items delimited with square brackets using python regular expressions

I'm trying to split out words/phrases delimited by square brackets using a python regular expression. I want to split the output. Conditions are that section of text beginning and ending with square ...
0
votes
0answers
31 views

what are the other frameworks for matching other than java.util.regex.*? [on hold]

Are any frameworks which can replace java.util.regex.* package, what are the disadvantages with java.util.regex.*
-1
votes
1answer
15 views

301 redirect regex for file paths to uploads directory

I am moving a website to wordpress and the site has hundreds of files available for download. The current file path may have a number of subfolders before the name of the file. Below are some examples ...
0
votes
0answers
8 views

Using regular expression in Hadoop distcp

I thought distcp uses same globbing syntax which most of us generally use for a MapReduce job when getting multiple inputs. But looks like I was wrong? If the same path with wildcard works for hadoop ...
1
vote
3answers
40 views

REGEX to select nth value from a list, allowing for nulls

I am using REGEXP_SUBSTR() to return the nth value from a comma-separated list. This works fine when all values are present, but fails if an item is null. Here is an example that works where all ...
3
votes
1answer
34 views

Why do Python findall() and finditer() return empty matches on unanchored .* searches?

The Python docs for findall() and finditer() state that: Empty matches are included in the result unless they touch the beginning of another match This can be demonstrated as follows: In ...
1
vote
1answer
39 views

c++ regex substring wrong pattern found

I'm trying to understand the logic on the regex in c++ std::string s ("Ni Ni Ni NI"); std::regex e ("(Ni)"); std::smatch sm; std::regex_search (s,sm,e); std::cout << "string object with " ...
-4
votes
0answers
13 views

Extracting specific types of links from html source document [on hold]

I want to extract specific links(to a video resource in mp4 format) from a batch of HTML documents. How can I do this using grep/sed? Is there any way I can input all HTML source files in batch and ...
-1
votes
1answer
23 views

How to match only first occurrence of space at line

I am getting stuck on maybe really simple step. I have line with following text [[StandardsEnterprise GXS Enterprise]] and want to replace first space by pipe ("|") Cannot find the regex for select ...