Tagged Questions
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.
0
votes
0answers
6 views
Stuck on specific REGEX (VB.Net)
I have a specific case where I somehow can't find something that suits my need. I've always been struggling when parenthesis comes in strong, and this case is a bit painful. I'm trying to collect the ...
0
votes
2answers
12 views
Regular Expression that contains 1 to 3 members of a set but one of those members cannot be by itself
Here's my current regular expression:
([\d\*]{1,3}[A-Z\*]{0,3})
My problem is with the first portion [\d\*]{1,3} I need this to match at most 3 numbers and at least one number and I need to accept ...
1
vote
2answers
14 views
Regular expression to find last group in python
I want to find last group in following text.See example below
Input string
str1 = "Calculate fuel economy, lease, or mortgage payments Click the View menu, point to Worksheets, and then click the ...
-2
votes
1answer
27 views
How to split sentence to words and punctuation using split or matcher?
I need to split sentence to words and punctuation marks, and place em into list, saving their sequence.
For example: "Some text here!". And result should be: List(Some, ,text, , here,!)
I'm using ...
0
votes
2answers
33 views
PHP: Regex to get name=“” 's value
I'm still very much learning Regex and I suck at it :(
I am getting an external webpage, saving it to a local file.
The page contains a form, now I need to find all the form's input's names and put ...
0
votes
2answers
17 views
Javascript: how to extract string from attribute via Regexp
How can I extract the string from a certain data attribute via regexp.
<button data-loading-text="Some text on loading" data-toggle="button">Button</button>
<button ...
2
votes
0answers
19 views
Regex not working in Firefox, but working in Chrome
I have this regex expression:
var message = message.replace(/<a.+?data-pageid=(?:"|')(\d+)(?:"|').+?<\/a>/g, '@[$1]');
It works fine for Chrome and cturns this text...
'some text <a ...
1
vote
1answer
11 views
MVC .net password validation using regular expression
I'm writing a regular expression to validate a password. The conditions are:
Password must contain at least two special characters
Password must be at least eight characters long
Password must be ...
0
votes
1answer
28 views
Python - Reading text file into dict
I have to read a text file in python into a dictionary, I have tried several options but I can't get it to work.
The format of the text file is the following:
Shop: someshop
Schedule: from 8:00 ...
0
votes
1answer
19 views
How to match every char except slash .htaccess
I'm trying to make .htaccess expression . How can I make preg to say to match every correcter that is possible including other languages like arabic except one char which is "/" . so basically I need ...
1
vote
0answers
13 views
FILTER_VALIDATE_REGEXP empty
I am trying to validate a field with php. I pass the value with POST, and it must contain only numbers and pipi ("|").
I'm using filter_input to check if the value validates:
...
1
vote
1answer
24 views
Regex to extract only contact info from an MBOX file into a csv
As the title suggests I am trying to parse a large MBOX file (16,000 emails in one file) and I am working on a small file for my test.
My php so far is:
$string = file_get_contents("test.mbox");
...
1
vote
0answers
9 views
Ansible: how to handle dots while using search or match functions
Here are the two scenarios and variable prefix will just hold another string.
1)This works:
when: ansible_hostname | search("{{ prefix }}-test-.*")
2)This doesn't work probably because of dots in ...
0
votes
1answer
16 views
Regex helped needed for angular filter which highlights matching text from html
I have this which works but but the regex is matching with html tags, is there any way I could get it to ignore html tags. Could anyone help me to modify the regex expression so my class is only ...
0
votes
1answer
37 views
Javascript difference between '/' and \/\
I'm trying to intercept in node.js all the get requests with the following:
dispatcher.onGet('/', function(req,res,chain) { ... });
but this isn't working. The following is working instead:
...
0
votes
2answers
22 views
MySQL — Order by SubString matching Index
I have a table which has companies (id, name).
Before I had to search the input query against records which was handled with "like". Sometime client wanted it to end with the input query sometime it ...
1
vote
0answers
10 views
Apache error 404 and FilesMatch
our server configuration is following:
ErrorDocument 404 http://www.domain.com/somepage
<FilesMatch "\.(gif|jpe?g|png|s?html|css|js)$">
ErrorDocument 404 default
</FilesMatch>
All ...
1
vote
2answers
27 views
Comment out file paths in a file matching lines in another file with sed and bash
I have a file (names.txt) with the following content:
/bin/pgawk
/bin/zsh
/dev/cua0
/dev/initctl
/root/.Xresources
/root/.esd_auth
... and so on. I want to read this file line by line, and use sed ...
0
votes
1answer
17 views
Regex Extract [Jmeter]
To make this short: I have a json response, and I need to extract some parameters from it. (Using jmeter, Regular Expression Extractor)
json response:
...
0
votes
2answers
33 views
Replace string with a function of replaced string
I would like to find a performant and elegant solution to this problem :
I need to replace a substring of a string, case insensitively, by a function of what have been replaced.
Example :
var ...
0
votes
0answers
28 views
rexexp_replace doesn't work as expected
I am trying to replace the below text to fill the question mark
SELECT REGEXP_REPLACE('?????/ ?????? John
??? ????? ??????? ?? ????? Pediatric Clinic ?? ??? 10 MAY 15 ?????? 01:15 PM
?????? ?????? ...
2
votes
0answers
13 views
How to use Groovy's replaceFirst with closure?
I'm a newbie on Groovy and have a question about replaceFirst with closure.
The groovy-jdk API doc gives me examples of...
assert "hellO world" == "hello world".replaceFirst("(o)") { ...
0
votes
3answers
24 views
Trying to replace parts of string start with same search chars
I'm trying to replace parts of my string. But I met a problem when my search string start with same character:
$string = "Good one :y. Keep going :y2";
$str = str_replace(array_keys($my_array), ...
1
vote
3answers
27 views
Regex match sequance more than once
How come for something that simple I can't find an answer after looking one hour in the internet?
I have this sentence:
HeLLo woRLd HOw are YoU
I want to capture all groups that consist of two ...
-1
votes
1answer
20 views
Detect white space or brackets at starting of string and particular substring from string in php
I want to detect occurrence of substring from main string but substring could start from space or ( opening bracket at starting or closing bracket at end ) or . dot at end
I want to write one ...
1
vote
2answers
50 views
How to find last alphabet in a string using c# .net
I want to find out the last alphabet in a string in c# .net. For instance, I have 1234B0097D576676 and I need to find D. Same as in 0103D0001Y000001, the result should be Y.
To do this there is a ...
1
vote
1answer
29 views
ASP.NET MVC - regular expressions. What does mean: ' sign?
I have this regular expression:
[RegularExpression(@"^[a-zA-Z''-'\s]{1,40}$")]
I would like to know what means sign: ' ? and what is its meaning in this regex?
-4
votes
0answers
17 views
I want code of python script which will read specific string in the file and modify string everytime I run the script
Suppose, there is a specific string in a file. I want to change a last character or digit of that string.how to replace it?
For Ex.= specific_string=1.0.2.1
Now, last digit of string i.e. 1 should ...
0
votes
1answer
27 views
What is the best practice to remove my own tag's contents?
I use Python 2.7 and Django 1.6.
I use unicode.
I'd like to remove my own tag's contents.
My own tag name is <nospeak>.
For example, if input the message below,
INPUT:
...
0
votes
2answers
16 views
Regex expression to grab value from similar text
I am having some trouble figuring out the regrex expression to grab value(highlighted in bold) from similar texts. Below are some examples of the logs that i'm collecting:
[5439570:00009-01286] ...
0
votes
0answers
4 views
Incomplete results - Google Custom Search API
I am working with the custom search API to check for matching sentences. For instance if the input text to search has more than one sentence & two of them are duplicates/copied, then my expected ...
1
vote
1answer
31 views
Regex.IsMatch for specific special characters in c#
I am new to Regex, I know this is a simple question but couldn't find a solution
I have a set of special characters (&, !, $, |) and a string. I just need to check whether the string contains any ...
-5
votes
1answer
27 views
What should be the Regx for 999x number?
I have the number in integer which can be anything from 1 to n.
Example : 1111, 9993, 9994, 99950, 9909
i want to know what is the regular expression to match and get numbers
which match to pattern ...
0
votes
2answers
13 views
Inline style reading in .net from a class file
I need to fetch the style from a html element from .net class file.
<img alt="" style="width: 81px; height: 61px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ...
0
votes
3answers
40 views
getting keys in a dictionary that do not contain “x” variable Python
I have the following dictionary
dictionary = {'\x85': 1, '\x84': 1, 'C': 3828}
What I want is only the keys and corresponding values for keys that don't contain digits, this is what I wrote ...
1
vote
3answers
20 views
Delete duplicate word in a line using a regular expiression
I want to delete duplicate word in a line.
For example:
arraythis1, XdashedSmall, Small, Medium, Large, XdashedLarge, XdashedSmall, Small, Medium, Large, XdashedLarge
I want to remove all of the ...
1
vote
4answers
54 views
How should I write a python regex for one/two digits numbers sequences?
I'm trying to create a python regex for "one or two digits numbers sequences separated by optional multiple spaces or an optional single comma."
For example:
" 1" Should tests good
" 1 2 ...
-2
votes
1answer
16 views
How to install php plugin in intellij idea?
I am trying to install php plugin in intellij idea, one plugin is install successfully, and its working on controller and model, but how to connect with ctp file.
0
votes
1answer
31 views
How to remove ALL IRC Colour codes from string
note: I'm using Python3
I've been searching everywhere and finding nothing complete. Asking on IRC everywhere. I need a regex expression that removes ALL IRC colour control codes. Nowhere is there a ...
-3
votes
2answers
21 views
javascript regex how to validate yyyy/yyyy format
Hello I have a text field, how do I make text only accept yyyy/yyyy format?
for example 2011/2012 or 2012/2013 like that, please provide me with example in regex. Thank You
0
votes
0answers
17 views
Extract parent and child node from python tree representation.?
[Tree('ROOT', [Tree('S', [Tree('INTJ', [Tree('UH', ['Hello'])]), Tree(',', [',']), Tree('NP', [Tree('PRP$', ['My']), Tree('NN', ['name'])]), Tree('VP', [Tree('VBZ', ['is']), Tree('ADJP', [Tree('JJ', ...
0
votes
2answers
28 views
How to match only equals pattern , in other word not contain pattern
String allString = " I1 + I6 + I9 + I8 + I3 + I2 + I20 + I21 + I18 + I23 + I28 + I27 + I31 + I24 + I12 + I15 + I14 + I13 + I16 + I11 "
How i check only "I1" in java regular expression pattern. ...
2
votes
1answer
33 views
Splitting Link using RegEx
i want to find category from the link. I am breaking the link into array using Regex like this.
string input = link;
string pattern = "/"; // Split on hyphens
string[] substrings = ...
0
votes
5answers
30 views
Regex Match Html Tag and Inner Html Pattern
I've scraped a web page and I'm trying to extract data from a td that has no class or ids. Let's say I have the following html:
<table>
<tr>
<td>Title</td>
...
0
votes
0answers
10 views
Regex syntax CEF log format
I am trying to use HIVE to parse the following some CEF log entries.
CEF is a hell of a weird format:
The headers are pipe delimited without enclosures, however, they accept escaped pipes within the ...
0
votes
1answer
10 views
Q: Duplicate any character using regex?
I want to duplicate any character using regex,
my regex is like this.
Test String:(.+\n)
Regex101 https://regex101.com/r/zE7wF7/1
Ouput:
24.5
24.5
24.5
24.5
24.5
24.5
24.5
24.5
24.5
24.5
44.5
44.5
...
1
vote
1answer
20 views
Is it possible to use asp:RegularExpressionValidator to validate phone number with at least 10 digits AND allow white spaces in-betweenBUTnotcounted
I searched the Stackoverflow and it seems that the other answers don't quite fit my question.
I wonder whether this is possible if I only use asp:RegularExpressionValidator to validate phone numbers ...
0
votes
2answers
11 views
Javascript Regex Problems : Nothing to repeat
replacedStr = replacedStr.replace(/&^*/g, "asdfasdf");
I need replace all with this regular expression:
/&^*/g
But it doesn't work, I can see the error messages Nothing to repeat in ...
1
vote
1answer
18 views
Need to refine this regex expression
The input I can get might be
/DemoSystems/DemoFramework/MyRepo/MyModule/tags/2015_02_22
or
/DemoSystems/DemoFramework/MyRepo/MyModule/tags/2015_02_22/Demo.Tests/AverageTests.cs
I need to extract ...
0
votes
1answer
14 views
Using REGEX, remove a date such as March 5, 2015
I am new with regex. I want to remove all the dates that match the format of March 20, 2015 in
"March 01, 2015 to March 05, 2015 JEEBRON, LEE (NT012-003) Date In 1 Out 1 In 2 Out 2 In 3 Out 3 In 4 ...