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.

learn more… | top users | synonyms (6)

0
votes
0answers
34 views

Java regexp complicated pattern

I have a string like this (made from HTML source code): <tr> <td> <tr>First</tr> </td> </tr> <tr> <td>Second</td> </tr> ...
0
votes
5answers
27 views

regex to allow only numbers and single dot in jquery

Regex to allow only numbers and single dot when entering number to textbox in jquery. Please suggest any regex to allow only numbers and single dot in textbox. I have tried the following code. ...
1
vote
0answers
16 views

Bash regex: replace string with any number of characters

I'm trying to remove colouring codes from a string; e.g. from: \033[36;1mDISK\033[0m to: DISK my regex looks like this: \033.*?m so match '\033' followed by any number of chars, terminated by 'm' ...
0
votes
1answer
43 views

Java Regex doesn't match although debug tools do

I have written a regular expression to parse strings of the format OBJECT_NAME KEY1=value KEY2=value (actually done by 2 regexps) This is my utils class: package de.hs.settlers.util; import ...
1
vote
1answer
9 views

Regular expression for GrepConsole

What is a regular expression which matches the following strings? [INFO] abcd1234_TCT_ALCATEL_one_touch_995 : Successfully uninstalled com.example.mapdemo from abcd1234_TCT_ALCATEL_one_touch_995 ...
-1
votes
0answers
18 views

htaccess rewrite rule based on Cookie

I want to redirect the request to a different site by checking whether the cookie "MY_cookie" is set or not. If its set, redirection should happen. This is the code that i am currently using, But not ...
0
votes
2answers
16 views

PHP - Extract form action url from mailchimp subscribe form code using regex

I'm creating a custom mailchimp form template for my users. So I would like to extract ONLY form action url from mailchimp code.. Can someone tell me how to extract action url from the following ...
0
votes
3answers
24 views

php only allow letters, numbers, spaces and specific symbols using pregmatch

on my php i use preg_match to validate input texts. if(preg_match('/^[a-zA-Z0-9]+$/', $firstname)) { } But this only allows alphanumeric and does not allow spaces. I want to allow spaces, alpha ...
1
vote
2answers
48 views

Get first occurence of match in Regex

I have the following text: "cat dog mouse lion" And I search for "dog" or "mouse" using regex: Regex regex = new Regex(@"dog|mouse"); The way Regex in C# behaves is that it first searches all the ...
1
vote
3answers
39 views

How to remove | Symbol from start and end

I tried the following code to remove | symbol from stand and end bus it does not work. "|aabckdoio|".replace("/^\|/g","").replace("/\|$/","")
0
votes
3answers
25 views

Regex how to match string that contains square bracket

How to match a string like this : firstword [foo = bar] and firstword using 1 regex. What I've tried is (\w+)[\s]{0,1}\[(.+)\] and by that I can only match the first one, I also tried by ...
0
votes
2answers
18 views

Split line comma at end of line and exclude special cases

Hi i have the following group: `group_id` int(10) unsigned NOT NULL, `right_id` int(10) unsigned NOT NULL, `group__right_value` enum('allow','deny') NOT NULL DEFAULT 'deny', KEY `group_id` ...
0
votes
3answers
28 views

get groups of characters n at a time

I'm trying to group a string by three (but could be any number) characters at a time. Using this code: "this gets three at a time".scan(/\w\w\w/) I get: ["thi","get","thr","tim"] But what I'm ...
1
vote
4answers
42 views

PHP - Convert a messy string to a useable one

I have a bunch of data from a football team that needs tidying up. Currently, it looks like this (for demonstration purposes, I've only included 3): 1 Team One 9 7 1 1 31 13 18 22 2 ...
2
votes
3answers
39 views

Replace every other character

how could i skip or replace every other character (could be anything) with regex? "abc123.-def45".gsub(/.(.)?/, '@') to get "a@c@2@.@d@f@5"

1 2 3 4 5 4050
15 30 50 per page