I've this string
String myString ="A~BC~FGH~~zuzy|XX~ 1234~ ~~ABC~01/01/2010 06:30~BCD~01/01/2011 07:45";
and I need to extract these 3 substrings
1234
06:30
07:45
If I use this regex \\d{2}\\:\\d{2} I'm only able to extract the first hour 06:30
Pattern depArrHours = Pattern.compile("\\d{2}\\:\\d{2}");
Matcher matcher = depArrHours...
Hello,
I need to match certain things from lines of an input text. The lines look like this:
to be/ Σ _ Σ [1pos, 1neg] {0=1, 2=1}
I am using the Scanner class to read each line of the text, and I have written the following code. However, something is not working properly, because the patter "to" is not matched against the line, and...
I need to pull a variable out of a URL or get an empty string if that variable is not present.
Pseudo code:
String foo = "http://abcdefg.hij.klmnop.com/a/b/c.file?foo=123&zoo=panda";
String bar = "http://abcdefg.hij.klmnop.com/a/b/c.file";
when I run my regex I want to get 123 in the first case and empty string in the second.
I'...
Now according to all the literature
echo 1234abcd|sed "s|[0-9]\+|#|g"
should return #abcd. And
echo abcd|sed "s|[0-9]\+|#|g"
should return abcd.
But on OS X 10.4.11 the first expression returns 1234abcd. Using * instead of + works for the first example but fails on the second, returning #abcd, because the [0-9] pattern is matched ...
I'm trying to parse a fragment of a stacktrace, which looks pretty much like this:
at Test.Test1() in C:\Projects\Project\Test.cs:line 37
Using a regex like this works as intended:
at (.*?) in (.*?):line (\d*)
This matches
Test.Test1()
C:\Projects\Project\Test.cs
37
This regex is hardcoded to an english stacktrace, so there are...
I have the following text that I am trying to parse:
"[email protected]" <[email protected]>, "Jane Doe" <jane.doe@ addyB.org>,
"[email protected]" <[email protected]>
I am using the following code to try and split up the string:
Dim groups As GroupCollection
Dim matches As MatchCollection
Dim regexp1 As New Regex("""(.*)"" <(.*)>...
I have written this script that replaces many spaces around the cursor with one space. This however doesn't work when I use it with no spaces around the cursor. It seems to me that Vim doesn't replace on a zero-width match.
function JustOneSpace()
let save_cursor = getpos(".")
let pos = searchpos(' \+', 'bc')
s/\s*\%#\s*/ /e...
I'm using this free RegExp Designer which does find and replace. How do I search for all numbers and add thousand separators?
Input: <node num='12345678'>
Output: <node num='12,345,678'>
...
I need to provide the P.O Box validation for the address Fields in the registration page. Now we have a regex validation in jquery which has some limitations as follows:
If an address polo Rd is given, it identifies "po" in polo and alerts error message.
So, we should frame a new validation which should not accept address lines wit...
I would like a c# regex to determine if a string contains 5+ characters within a defined sequence.
Example: If the sequence was the alphabet then 'ghijk' would be true, while 'lmn' would be false.
Edit: The sequence needs to be in order. from example above 'ghijz' would return false.
...
Hello,
I need to extract in actionscript the variables from a string like /var1/var2/var3/...
Each variables can be characters or/and number and variable size.
My current regex /(\w+)/g work for the first variable but not for the others.
var matchExpression:RegExp = /(\w+)/g;
var match:Array = matchExpression.exec(browserManager.fra...
I was trying to search for ".IsSet", but not "DocumentState.IsSet", in VS 2008 using regular expression search. How do I compose the regular expression?
Thanks!
...
I'm working on this pretty big re-factoring project and I'm using intellij's find/replace with regexp to help me out.
This is the regexp I'm using:
\b(?<!\.)Units(?![_\w(.])\b
I find that most matches that are not useful for my purpose are the matches that occur with strings within quotes, for example: "units"
I'd like to find a way...
I'm adding a feature to an existing script that will allow the user to configure the hostname of a Linux system. The rules I'm enforcing are as follows:
Must be between 2 and 63 characters long
Must not start or end with a hyphen
Can only contain alphanumeric characters, and hyphens; all other characters are not allowed (including an u...
I'm using javascript to set the value of an input with text that may contain html specific chars such a & etc. So, I'm trying to find one regex that will match these values and replace them with the appropriate value ("&", " ") respectively, only I can't figure out the regex to do it. Here's what I'm trying to do. Make an o...
How would you create a regular expression that would parse the following url
http://example.com/answers/38-my-example-question-on-regular-expression
Specifically, "/answers/38-my-example-question-on-regular-expression" versus "/answers/category"
If the regex finds "38" a number, then it does this:
RewriteRule answers/([-_~*a-zA-Z0-9]...
Hi,
I'm looking to match Twitter syntax with a regex.
How can I match anything that is "@______" that is, begins with an @ symbol, and is followed by no spaces, just letters and numbers until the end of the word? (To tweeters, I want to match someone's name in a reply)
...
Given a needle and a haystack... I want to put bold tags around the needle. So what regex expression would I use with replace()? I want SPACE to be the delimeter and I want the search to be case insensitive
so say the needle is "cow" and the haystack is
cows at www.cows.com, milk some COWS
would turn into
<b>cows</b> at www.cows.com...
Ok, so basically I am using the fckeditor as a way for my user to enter some information. When it is stored in the DB it is stored like so,
<p> </p>
<div style=\"margin: 0in 0in 10pt\"><b><span style=\"color: #666666\">Test Title</span></b><span style=\"color: #666666\"> <br />
Address goes here <br />
This is some lengthy text about ...
I need a regular expression that will properly work, the current one I have is breaking.
The goal is
Normal src for an image is:
Image.png
Using jQuery on hover I dynamically find the src of an image and replace it with ImageName-Dn.png
On hover off it sets it back to ImageName.png
My current solution:
$(document).ready(function()...