I have some HUGE log files (50Mb; ~500K lines) I need to start filtering some of the crap out of. The log files are being produced using log4j and have the basic pattern of:
[log-level] date-time class etc, etc
log-message
I'm looking for a way that I can identify a regex start and regex end (or something similar) that will filte...
how to get value without <br/> tag using regex n java?
my String is:
<Div>
West Newton, MA 02465
<br/>USA
</Div>
output should be like:
West Newton, MA 02465
USA
my pattern is like:
Pattern p8 = Pattern
.compile("<div class=\"leftLabel\">Nickname</div>\\s+<div class=\"rightContent\">([^<]*)</div>");
Matcher ...
Hi I'm struggling with some regex
I've got a string like this:
a:b||c:{d:e||f:g}||h:i
basically name value pairings. I want to be able to parse out the pairings so I get:
a:b
c:{d:e||f:g}
h:i
then I can further parse the pairings contained in { } if required
It is the nesting that is making me scratch my head. Any regex experts o...
I'm trying to parse a text file that has ANSI color sequences in it, e.g.
\e[0;37m
How can I build a regex to match this in Ruby?
...
For instance, if I wanted to a find and replace with strings containing backward or forward slashes, how would this be accomplished in vim? Thank you!
Examples
Find & Replace is : :%s/foo/bar/g
what if I wanted to find all occurences of <dog/> and replace it with <cat\>
...
I have a string that looks like this:
"#Text() #SomeMoreText() #TextThatContainsDelimiter(#blah) #SomethingElse()"
I'd like to get back
[#Text(), #SomeMoreText(), #TextThatContainsDelimiter(#blah), #SomethingElse()]
One way I thought about doing this was to require that the # to be escaped into \#, which makes the input string:
"#Te...
I need to do a find and replace in Notepad++ of
Err.Number, canBeAnything, canBeAnything, Err.Description
(where canBeAnything is just what it says)
with
Err.Number, "canBeAnything", "canBeAnything", Err.Description
(basically, put quotes around canBeAnything)
I got as far as the find
Err.Number, .+, .+, Err.Description
...
I am sanitizing an input field and manually getting and setting the caret position in the process. With some abstraction, here's the basic idea:
<input type="text" onkeyup"check(this)">
And javascript...
function check(element) {
var charPosition = getCaretPosition(element);
$(element).val( sanitize( $(element).val() ) );
setCa...
I'm trying to use a regex as an input, and from there generate all the possible values that the regex would match.
So, for example, if the regex is "three-letter words starting with a, and ending in c," then the code would generate a list with the values [aac, abc, acc, adc, a1c....].
Is there an easy way to do this? I'm using python.
...
I am trying to write a tokenizer for Mustache in Perl. I can easily handle most of the tokens like this:
#!/usr/bin/perl
use strict;
use warnings;
my $comment = qr/ \G \{\{ ! (?<comment> .+? ) }} /xs;
my $variable = qr/ \G \{\{ (?<variable> .+? ) }} /xs;
my $text = qr/ \G (?<text> .+?...
I have a regular expression validation control initialized to validate a textbox control. I want users to be able to enter U.S. Currency values ($12,115.85 or 1500.22 etc.). I found a regular expression off of regexlib website that does the trick. The validation control seems to be working except for one crucial thing. If invalid data is...
Hi,
I have a text file with text like:
"Lorem ipsum text. Second lorem ipsum. How are You. It's
ok. Done. Something else now.
New line. Halo. Text. Are You ok."
I need a regex to find all sentences (between .) except ones with the word "else" within it. I'm trying many regex patterns but nothing works.
Can I do this with regex?
...
why does the following js expression:
"test1 foo bar test2".replace(/foo.bar/, "$'")
result in the following string?
"test1 test2 test2"
is the $' in the replace string some sort of control code for including everything after the match???
this behavior was screwing with me most of the day. can anyone explain this?
thanks a lot
...
Are regular expressions the same for PHP, MySQL, JavaScript, Perl, and so on? If so, is there a chart or tutorial that explains regular expressions?
...
What does the $/i mean in the following php code?
preg_match ('/^[A-Z \'.-]{2,20}$/i')
...
I was wondering if the codes below are the correct way to check for a street address, email address, password, city and url using preg_match using regular expressions?
And if not how should I fix the preg_match code?
preg_match ('/^[A-Z0-9 \'.-]{1,255}$/i', $trimmed['address']) //street address
preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z...
I'm really getting my butt kicked here. I can not figure out how to write a search and replace that will properly find this string.
String:
$QData{"OrigFrom"} $Text{"wrote"}:
Note: That is the actual STRING. Those are NOT variables. I didn't write it.
I need to replace that string with nothing. I've tried escaping the $, {, and...
Hi all,
I am up to my neck in regular expressions, and I have this regular expression that works in javascript (and flash) that I just can't get working in PHP
Here it is:
var number
= '(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)';
var oneChar = '(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]'
+ '|\\\\(?:[\"/\\\\...
I have the following input to a Perl script and I wish to get the first occurrence of NAME="..." strings in each of the <table>...</table> structures.
The entire file is read into a single string and the regex acts on that input.
However, the regex always returns the last occurrence of NAME="..." strings. Can anyone explain what is goi...
I have a large textfile, which has linebreaks at column 80 due to console width. Many of the lines in the textfile are not 80 characters long, and are not affected by the linebreak. In pseudocode, this is what I want:
Iterate through lines in file
If line matches this regex pattern: ^(.{80})\n(.+)
Replace this line with a new string c...