I'm new to Perl and regular expressions and I am having a hard time extracting a string enclosed by double quotes. Like for example,
"Stackoverflow is
awesome"
Before I extract the strings, I want to check if it is the end of the line of the whole text was in the variable:
if($wholeText =~ /\"$/) #check the last character if " wh...
Hi,
I've been googling & trying to get this myself but can't quite get it...
QUESTION: What regular expression could be used to select text BETWEEN (but not including) the delimiter text. So as an example:
Start Marker=ABC
Stop Marker=XYZ
---input---
This is the first line
And ABCfirst matched hereXYZ
and then
again ABCsecond match...
public static String removeNonDigits(final String str) {
if (str == null || str.length() == 0) {
return "";
}
return str.replaceAll("/[^0-9]/g", "");
}
This should only get the Digits and return but not doing it as expected! Any suggestions?
...
Hello all,
I have two questions, one is wordy and one programmy!
1) I know that PHP reporting on notices causes performnace problems (takes time to report on these errors and figure out what sort of error it is) but is this the same case if error_reporting is turned off? I guess it still does slow down performance but not as much as di...
I have a requirement to grep a string or pattern (say around 200 characters before and after the string or pattern) from an extremely long line ed file. The file contains streams of data (market trading data) coming from a remote server and getting appended onto this line of the file.
I know that I can match lines containing a specific...
Hey all.
Thanks in advance.
I would like a regular expression that removes anything that is NOT alpha numeric and a hyphen. So allowed are A-Z 0-9 and -.
Also, how could I apply that to a string in Javascript?
Thanks again.
...
I have a javascript variable containing the HTML source code of a page (not the source of the current page), I need to extract all links from this variable.
Any clues as to what's the best way of doing this?
Is it possible to create a DOM for the HTML in the variable and then walk that?
...
I'm trying to create a bbcode filtering solution that works with both PHP and Javascript. Right now I'm working on the javascript. I'm having trouble getting the new RegExp constructor to recognize the patterns in my json. Here's a small bit of sample code that reproduces the issue. Any insight would be greatly appreciated!
bbcode.json
...
I'm trying to create a method that provides "best effort" parsing of decimal inputs in cases where I do not know which of these two mutually exclusive ways of writing numbers the end-user is using:
"." as thousands separator and "," as decimal separator
"," as thousands separator and "." as decimal separator
The method is implemented...
I am trying to convert an underscore to dash in php.
hi i have a regular expression that converts white spaces to dash but how can i achieve underscore to dash?
$item = preg_replace('/\ +/', '-', $item);
...
Hi,
Can anyone help me with a regular expression that will return the end part of an email address, after the @ symbol? I'm new to regex, but want to learn how to use it rather than writing inefficient .Net string functions!
E.g. for an input of "[email protected]" I need an output of "example.com".
Cheers!
Tim
...
We have a configuration file that lists a series of regular expressions used to exclude files for a tool we are building (it scans .class files). The developer has appended all of the individual regular expressions into a single one using the OR "|" operator like this:
rx1|rx2|rx3|rx4
My gut reaction is that there will be an expressio...
Is there a way to rewrite this regex expression such that it does not include a lookahead for "/js"?
Is this even something that I should worry about in terms of performance? It is being used to filter HTTP requests.
\.(asmx(?!/js)|aspx|htm)
Edit:
To be clear: I'd like to specifically prevent ".asmx/js" but allow all other .asmx re...
I have the following string. I have broken it into two lines below for clarity but they are one line.
WHEN NVL(somevar1, 0) > 0 THEN
(CAST(NVL(somevar2, 0) AS
FLOAT(53)) / CAST(NVL(somevar3, 0) AS FLOAT(53))) * 100
I want to write a Regex so that I can get somevar1, somevar2 and somevar3.
I was trying with something like this...
Hi folks! I have a list of a few thousand terms. There is significant overlap in those terms, but in different forms. For example (ruby, a_ruby), (triathlon, triathlete, triathletes), (nonprofit, non_profit, non_profits).
Most of these have significant number of character overlap, but not exactly in the same form. For example, (nonprof...
Hi, I'm trying to write a regular expression in flash that will find the word "ho" but not the words that contain this, like though, how, who, thought, etc...
I'm not asking for an explicit solution but a point in the right direction or an example would be appreciated. Thanks in advance.
...
I have the following regex and would like it to match the following two lines. It appears to match the first end tag it finds rather than the last. How can it be modified to find the last one not the first.
Regex: <div(?<Attr>.*?)>(?<Content>.*?)</div>
Currently matches: <div class="test">Test Div</div>
...
Here is the .NET Regular Expression that I am using to create a strong password (which is not correct for my project password requirements):
(?=^.{15,25}$)(\d{2,}[a-z]{2,}[A-Z]{2,}[!@#$%&+~?]{2,})
Password requirements:
Minimum 15 Character (up to 25)
Two Numbers
Two Uppercase Letters
Two Lowercase Letters
Two Special Characters ! ...
I don't quite understand the example given from the 'man find', can anyone give me some examples and explanations? Can I combine regular expression in it?
the more detailed question is like this: write a shell script, changeall, which has an interface like "changeall [-r|-R] "string1" "string2". It will find all files with an suffix ...
Are there any libraries or technologies(in any language) that provide a regular-expression-like tool for any sort of stream-like or list-like data(as opposed to only character strings)?
For example, suppose you were writing a parser for your pet programming language. You've already got it lexed into a list of Common Lisp objects repres...