I've constructed a regular expression which I compile to a Pattern to find Fortran Real*8 numbers. The tricky bit is that the file I'm reading from is a single line with a few million columns..
When I do this:
Scanner recordScanner = new Scanner(recordString);
String foundReal = recordScanner.findInLine(real8Regex);
I get what I'm lo...
Guys,
Not gonna lie, I'm terrible at regex.
How would I be able to do this guys:
$string = '>Data 1-23</a>';
$string = '>Datkl3</a>';
$string = '>RA Ndom</a>';
And pull out the "Data 1-23" from inside the above string using regex? And if I have multiple ones of this, how would I be able to put all of the matched strings into an arra...
i am using Php.
given 2 urls like this, http://soccernet.com and http://soccernet.espn.go.com/index?cc=4716
how to tell that they are actually the same?
also consider situation where the difference is the httpS, like https://gmail.com and http://gmail.com
please advise. I am finding it a struggle at using regex because sometimes it ...
Guys, this probably will be fairly simple, but how am I able to find all the matches using regex of this occurrence in a load of text.
[[data in here]]
EG:
Blah blah blah [[find]] and maybe [[this]]
So I am able to find the occurrences and then replace them as urls.
Does that make sense?
I tried using
preg_match_all("/[[([^<]*)]...
I am reading contains of an HTML page for some details, I'm searching for every occurrence of a string, that string comes withing a tag, I want to read just that string only.
Example:
<a href="http://www.example.com/search?la=en&q=javascript">javascript</a>
<a href="http://www.example.com/search?la=en&q=PHP">PHP&l...
Hi I'm trying to extract the parameters from a class definition.
class locale.company.app.LoginData(username:String, password:String)
I have extracted the package name and class name, but the parameters are causing me some trouble.
I used Rubular to construct the following regex:
http://www.rubular.com/regexes/9597
According to Ru...
How would the '.+?' regular expression work? Is the .+ part matching anything written, and the ? part saying it can either be there or not? So, for example, this regular expression would match:
'cat'
'' (ie, nothing written, just the empty string)
...
Quick background: I have a string which contains references to other pages. The pages are linked to using the format: "#12". A hash followed by the ID of the page.
Say I have the following string:
str = 'This string links to the pages #12 and #125'
I already know the IDs of the pages that need linking:
page_ids = str.scan(/#(\d*)/)....
I am developing an ecommerce website with CI that has product categories and products. I want to route the URL so that it will go to the products controller, then run the getCategoryByName function for the first segment, then run the getProductByName for the second segment. Here is what I have:
URL:
products/docupen/rc805
routes.php...
An answer from another question piqued my curiosity.
Consider:
$string = "asfasdfasdfasdfasdf[[sometextomatch]]asfkjasdfjaskldfj";
$regex = "/\[\[(.+?)\]\]/";
preg_match($regex, $string, $matches);
$regex = "/\[\[(.*)\]\]/";
preg_match($regex, $string, $matches);
I asked what the difference between the two regexes is. The aswer I ...
I'm trying to replace all the occurrences of a variable in a string using javascript.
This is not working.:
var id = "__1";
var re = new RegExp('/' + id + '/g');
var newHtml = oldHtml.replace( re, "__2");
This is only replacing the first occurrence of id:
var id = "__1";
var newHtml = oldHtml.replace( id,"__2");
What am I doing w...
I'm having trouble with the needed regular expression... I'm sure I need to probably be using some combination of 'lookaround' or conditional expressions, but I'm at a loss.
I have a data string like:
pattern1 pattern2 pattern3 unwanted-groups pattern4 random number of tokens pattern5 optional1 optional2 more unknown unwanted junk sepa...
Is it possible to return a string between 2 strings, using regex? For example, if I have this string:
string = "this is a :::test??? string";
Can I write a function to return the word "test" using a regex?
Edit: Sorry, I'm using C#
...
I have to clean some input from OCR which recognizes handwriting as gibberish. Any suggestions for a regex to clean out the random characters? Example:
Federal prosecutors on Monday charged a Miami man with the largest
case of credit and debit card data theft ever in the United States,
accusing the one-time government informant of ...
Hi, im trying to validate a string of text that must be in the following format,
The number "1" followed by a semicolon followed by between 1 and three numbers only - it would look something like this.
1:1 (correct)
1:34 (correct)
1:847 (correct)
1:2322 (incorrect)
There can be no letters or anything else except numbers.
Does anyo...
Hi,
I've got a Regex question, I have to recognize tokens in a text that are like:
Foo- followed by either bar or baz followed by - then some numbers, like:
Foo-bar-010
Foo-baz-101
I then want to divide my matches like : Foo-bar -010 and Foo-baz -101
My regex is this one:
(Foo-(bar|baz))-[0-9]+
Which is kinda cool, but I don'...
Suppose I have '/srv/www/site.com/htdocs/system/application/views/' and want to test it against a regexp that matches each directory name in the path?
Something like this pattern: '(/[^/])'
That yields an array with 'srv','www','site.com'... etc.
PS: the regexp syntax I wrote is just to illustrate, it's not tested and surely wrong, but...
I need a regex to get numeric values that can be
111.111,11
111,111.11
111,111
And separate the integer and decimal portions so I can store in a DB with the correct syntax
I tried ([0-9]{1,3}[,.]?)+([,.][0-9]{2})? With no success since it doesn't detect the second part :(
The result should look like:
111.111,11 -> $1 = 111111; ...
How do I replace a single question mark with preg replace.
...
Short version:
How can I get a regex that matches [email protected] but not [email protected] using CAtlRegExp ?
Long version:
I'm using CAtlRegExp http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx to try to match email addresses. I want to use the regex
^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$
extracted from here.
But the syntax t...