I am using php preg_match and I have the original expression as:
|(label\">Carried Price </span> £)((.)*?)( </div)|
But I want to be able to able to be able to use the same basic expression but be able to search for Carried Price or Web Exclusive. I tried something like:
|(label\">[Carried Price|Web Exclusive] </span> £)((.)*?)...
What is the best tool to make complex (multi-line) regular expression file contents searches with good reporting capabilities?
I need to make a report over large Java/JSP code base and I have to make some charts afterward.
Eclipse is rather good at searches, but it does not provide good report of what is found. It just shows the tree ...
When validating URLs, I was wondering if the root could be setup like this:
http://my.great.web.site.I.rule.com/
I guess the real question is, if someone wanted to buy a .com with the name "some.site", would the above example be possible?
I was thinking something like that was out of the ordinary, and that the maximum would be someth...
Say i have a string of text such as
$text = "Hello world, be sure to visit http://whatever.com today";
how can i (probably using regex) insert the anchor tags for the link (showing the link itself as the link text) ?
...
I'm looking for a way to search through terabytes of data for patterns matching regexes. The implementation does need to support a lot of the finer capabilities of regexes, such as beginning and end of line data, full TR1 support (preferably with POSIX and/or PCRE support), and the like. We're effectively using this application to test...
I need to extract the text (characters and numbers) from a multiline string. Everything I have tried does not strip out the line feeds/carriage returns.
Here is the string in question:
"\r\n 50145395\r\n "
In HEX it is: 0D 0A 20 20 20 20 20 20 20 20 35 30 31 34 35 33 39 35 0D 0A 20 20 20 20
I have tried the following:
$s...
Hello,
Background:
I'm using Checkstyle 4.4.2 with a RegExp checker module to detect when the file name in out java source headers do not match the file name of the class or interface in which they reside. This can happen when a developer copies a header from one class to another and does not modify the "File:" tag.
The regular expres...
Hi
Consider the following example:
$target = 'Xa,a,aX';
$pattern = '/X((a),?)*X/';
$matches = array();
preg_match_all($pattern,$target,$matches,PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER);
var_dump($matches);
What it does is returning only the last 'a' in the series, but what I need is all the 'a's.
Particularly, I need the position of ...
Hello,
I have an array of tags that I'm pulling from a database, I am exporting the tags out into a tag cloud. I'm stuck on getting only the first instance of the word. For example:
$string = "test,test,tag,tag2,tag3";
$getTags = explode("," , $string);
foreach ($getTags as $tag ){
echo($tag);
}
This would output the test...
Hi I want to search something in the file which looks similar to this :
Start Cycle
report 1
report 2
report 3
report 4
End Cycle
.... goes on and on..
I want to search for "Start Cycle" and then pull out report 1 and report 3 from it.. My regex looks something like this
(Start Cycle .*\n)(.*\n)(.*\n)(.*\n)
The above regex selec...
My task is to determine if a string should cause a command to be raised in my C# command processor, this being configurable at runtime.
I have two collections of regexes. For the first collection 'EnabledPatterns' the command is enabled if any one of the patterns matches the command string. For the second 'DisabledPatterns' the command...
In Perl it is possible to do something like this (I hope the syntax is right...):
$string =~ m/lalala(I want this part)lalala/;
$whatIWant = $1;
I want to do the same in Python and get the text inside the parenthesis in a string like $1.
...
I've been using "/x{201C}/u" and "/x{201D}/u" to match them, but there's no result.
Am I doing something wrong??
...
I have seen several regular expressions that have two plusses in a row. What exactly does this mean? One or more of one or more of the pattern. If the pattern matches in the first place, why would the second match be necessary?
Examples:
[a-zA-Z0-9_]++
[^/.,;?]++
...
I need a way to simplify this command:
grep 'SEARCHTERM' server.log | grep -v 'PHHIABFFH' | grep -v 'Stats'
It should find all the lines including SEARCHTERM but exclude if one of the SEARCHTERM lines includes PHHIABFFH or Stats.
...
I have some document stored as a large String. In the String I have some inline XML tags and I want to get out the words inbetween the tags. The documents may also contain HTML tags, as the documents are often web sites.
Example Document:
"< tr > My name is < b >< PERSON >Bobby< /PERSON >< /b >, I live in the USA."
Current RegEx:
...
So I need to match an ipv6 address which may or may not have a mask. Unfortunately I can't just use a library to parse the string.
The mask bit is easy enough, in this case:
(?:\/\d{1,3})?$/
The hard part is the different formats of an ipv6 address. It needs to match ::beef, beef::, beef::beef, etc.
An update: I'm almost there..
/^...
In a sort-of-duplicate, the answer was :
\[start\](.*?)\[end\]
but that yields the [start] and [end] tag too. How do you omit them?
E.g.: f("[somestartstring]result[someendstring]") == "result"
UPDATE: the suggested answers are not working. My code is:
printfn "%s" (Regex.Match(@"[start]result[end]",
"\\...
Hi all,
I got the following text:
PRINT CONVERT(NVARCHAR,
CURRENT_TIMESTAMP, 111) + ' ' +
CONVERT(NVARCHAR, CURRENT_TIMESTAMP,
108)
+ ' -Test Mode : ' + (CASE WHEN @turbo_mode_ind = 1 THEN
'some text ''test'' some more text.'
ELSE 'an...
Ok so i have this piece of code:
def findNReplaceRegExp(file_name, regexp, replaceString, verbose=True, confirmationNeeded=True):
'''Replaces the oldString with the replaceString in the file given,\
returns the number of replaces
'''
# initialize local variables
cregexp = re.compile(regexp, re.MULTILINE | re.DOTALL)
somet...