I have an ASCII formatted file with 250k+ lines of text on which I need to perform 2 steps.
1) scan through the entire file and delineate sections by matching a given regular expression pattern.
2) read each section of data and parse subsections from it.
One option is to use line-oriented scan of the file utilizing a BufferedReader, t...
I need to take request for
www.domain.com/123456/Catalog.aspx
and rewrite to
www.domain.com/Products/Catalog.aspx?ItemID=123456
where 123456 will always be numbers.
Any help is appreciated. Thanks.
...
I'm trying to pull the name "Dave" (but it will be different depending on who is logged in) out of the following string:
Logged In: Dave - example.com
Any thoughts on the best way to do this with regex in JS?
...
Hi to all,
I want parse, with iPhone's NSRegularExpression class, this text:
<td class="rowhead">Uploaded</td><td align="left">652.81 GB</td>
for extract Uploaded and 652.81 text.
Thanks in advanced boys!
...
Hi!
I need Git command to get/find last tag starting with 'v' to get last versioning commit (I am using tags with v letter at the beginning to tag next application version (example: v0.9.1beta).
Is there any way to do it?
...
I want to replace
{youtube}Video_ID_Here{/youtube}
with the embed code for a youtube video.
So far I have
preg_replace('/{youtube}(.*){\/youtube}/iU',...)
and it works just fine.
But now I'd like to be able to interpret parameters like height, width, etc. So could I have one regex for this whether is does or doesn't have...
I am stumped by this practice problem (not for marks):
{w is an element of {a,b}* : the number of a's is even and the number of b's is even }
I can't seem to figure this one out.
In this case 0 is considered even.
A few acceptable strings: {}, {aa}, {bb}, {aabb}, {abab}, {bbaa}, {babaabba}, and so on
I've done similar examples where t...
I am trying to make a rewrite rule to check whether the URL ends with .htm or .html, but does not contain Archive.aspx.
The url starts out like
www.contoso.com/test.htm (or .html)
and ends up like
www.contoso.com/Archive.aspx?page=/test.htm
How can I do this with a regular expression?
...
Hey everyone,
I'm looking for a Regex that will take this:
?pm=512862895835
And turn it into this:
?pm=512862895835.png
I'd be running the expression on HTML.
Thanks,
rocky
...
Hello, the following python script allows me to scrape email addresses from a given file using regular expressions.
How could I add to this so that I can also get phone numbers? Say, if it was either the 7 digit or 10 digit (with area code), and also account for parenthesis?
My current script can be found below:
# filename variables...
Hai.. kindly check my file content
From: Bablu Pal <[email protected]>
To: Anirban Ghosh <[email protected]>; Arindam <[email protected]>; arpita <[email protected]>; Arpita Das <[email protected]>; Bijoy Mandal <[email protected]>; Goutam <[email protected]>; "[email protected]" <[email protected]>; "junas9k@...
I am trying to extract blocks of JSON data from a data stream in the following format:
Some-Header-Name:Value
Content-Length:Value
Some-Other-Header:Value
{JSON data string of variable length}
The stream contains many instances of the above pattern and the length of JSON data in each instance is different, as indicat...
Hi,
Maybe this is a very rare (or even dumb) question, but I do need it in my app.
How can I check if a C# regular expression is trying to match 1-character strings?
That means, I only allow the users to search 1-character strings. If the user is trying to search multi-character strings, an error message will be displaying to the user...
String to be split
abc:def:ghi\:klm:nop
String should be split based on ":"
"\" is escape character. So "\:" should not be treated as token.
split(":") gives
[abc]
[def]
[ghi\]
[klm]
[nop]
Required output is array of string
[abc]
[def]
[ghi\:klm]
[nop]
How can the \: be ignored
...
Hi
Using VB or C#, I am getting a string of variable length from the database. This information is sensitive information that only certain users will be able to see.
I have two cases that will use the same logic (I think).
scenario 1: replace all characters with x
scenario 2: replace all characters with x except the last 4 characters...
Hi all,
this code was working fine till this morning, can anyone spot my mistake? probably really silly but it has me stumped!
i use a form to submit a file (field name 'fileUpEx'), and then i wrote a class to upload it (like i said, it's been working for ages)....
(if i write 'filepath' to the page it is 'Test copy.pdf')
My class retur...
Possible Duplicate:
How to get IMG tag code from HTML document?
I need help to make preg_match_all() for every image URL on random page.
As far I do this
preg_match_all('/img[\d\D]+?src\=(\'|\")([\d\D]+?)(\'|\")/i', $page, $matches);
But won't work for every page.
Must match all possible image closed in img src also ones...
How do I remove white spaces in a string but not new line character in JavaScript. I found a solution for C# , by using \t , but it's not supported in JavaScript.
To make it more clear, here's an example:
var s = "this\n is a\n te st"
using regexp method I expect it to return
"this\nisa\ntest"
...
I have an input like this (a JSON format)
{"location":[{"id":"1BCDEFGHIJKLM","somename":"abcd","fewname":"xyzland","sid":"","sname":"","regionname":"Zee-Whole","type":"some","siteCode":"","someCode":"ROTXY","fewCode":"NL","pCode":"ROTXY","someid":"1BCDEFGHIJKLM","fewid":"GIC8"},{"id":"7823XYZHMOPRE","somename":"abcd Junction","fewname":...
I am trying to capture img tag in HTML using Regex...
So these must be captured:
<img/>
< img id = "f" />
I have used:
"<\s*img(\s.*?)?/>"
But this goes wrong:
< img id = "/>" />
Any idea how to probably capture img tag??
Thanks
...