Does anybody know which domains to search for (other than ".mil") to look for military addresses posting to a web form?
Clarification: we're offering a discount to our customers, and we really only have time to cough up an email address regex which can fit into our existing system.
This is on LAMP.
...
First things first: Neither this, this, this nor this answered my question. So I'll open a new one.
Please read
Okay okay. I know that regexes are not the way to parse general HTML. Please take note that the created documents are written using a limited, controlled HTML subset. And people writing the docs know what they're doing. They ...
Hi.
Is this possible with regex?
I have a file, and if a '@' is found in the file, the text after the '@' with the '@' is to be replaced with the file with the same name as after the '@'.
File1: "this text is found in file1"
File2: "this file will contain text from file1: @file1".
File2 after regex: "this file will contain text from fi...
Hi,
How can I look for links in HTML and remove them?
$html = '<p><a href="javascript:doThis('Test Title 1')">Test Title 1</a></p>';
$html .= '<p><a href="javascript:doThis('Test Title 2')">Test Title 2</a></p>';
$html .= '<p><a href="javascript:doThis('Test Title 3')">Test Title 3</a></p>';
$match = '<a href="javascript:doThis('Test ...
Regex fun again...
Take for example http://something.com/en/page
I want to test for an exact match on /en/ including the forward slashes, otherwise it could match 'en' from other parts of the string.
I'm sure this is easy, for someone other than me!
EDIT:
I'm using it for a string.match() in javascript
...
hi All,
I have a regex /(.+)_id$/ in a rails application that matches any string that ends with _id . I need it to match any string that ends with _id except associated_id. How can I accomplish this?
thx :)
-C
...
I'm trying to parse an HTML file for strings in this format:
<a href="/userinfo/userinfo.aspx?ID=305157" target="main">MyUsername</a> O22</td>
I want to retrieve the information where "305157", "MyUsername" and the first letter in "O22" (which can be either T, K or O).
I'm using this regex; <a href="/userinfo/userinfo\.aspx\?ID=\d*"...
I have a web bot which extracts some data from a website. The problem is that the html content is sent without line brakes so it's a little bit harder to match certain things so I need to extract everything that is between td tags. Here's a string example:
<a class="a" href="javascript:ow(19623507)">**-**-**-***.cstel.net</a> (<b>...
I need to match any kind of string which has at least a . (dot) and a * (star) character and not a < or > (html tags). Any ideas? Thanks.
...
Hello,
I'm trying to match a string that contains HTML code that contains parameters to a function in Javascript.
There are several of these functions found in the the string containing the HTML code.
changeImg('location','size');
Let's say that I want to grab the location within the single quotes, how would I go about doing this? T...
I need to write a regular expression to check for valid bank account number format of major banks in USA and Canada (I already know the format for transit number and institution number, but I don't know the format for account number). Does anyone know what regular expression check should be? Perhaps I just check to make sure all charac...
Hi,
I'm trying to write a simple php function that will strip everything between two brackets within a string.
Here is what a typical string will look like:
[img_assist|nid=332|title=|desc=|link=none|align=left|width=70|height=61] On November 14, Katherine Grove participated in Tulane University's School of Architecture Continuing Edu...
[(',', 52),
('news', 15),
('.', 11),
('bbc', 8),
('and', 8),
('the', 8),
(':', 6),
('music', 5),
('-', 5),
('blog', 4),
('world', 4),
('asia', 4),
('international', 4),
('on', 4),
('itunes', 4),
('online', 4),
('digital', 3)]
Suppose I have this list, with tuples inside.
How do I go through the list and remove elemen...
This is a question:
"Where is the car?"
This is NOT a question:
"Check this out: http://domain.com/?q=test"
How do I write a function to analyze a string so that we know for sure it is a question and not part of a URL?
...
if I have string let say "abcddgert234edddscddvbasdeddd"
and if I want to search a pattern "ddd"
what would be the raw logic?
Some sort of String searching algorithm
...
I'm trying to escape regex-reserved characters with a backslash (don't ask -- suffice it to say I'm NOT trying to parse HTML :) ) And I'm getting something odd.
$regex_chars = array('[' , '\\' , '^', '$' , '.' , '|' ,
'?' , '*' , '+' , '(' , ')');
$regex_chars_escaped = array('\[ ' , '\\\\ ' , '\^ ', '\& ' ,
'\. ' , '\| ' , '\? ' ...
A recent blog entry by a Jeff Atwood says that you should never parse HTML using regular expressions - yet doesn't give an alternative.
i want to scrape search search results, extracting values:
<div class="used_result_container">
...
...
<div class="vehicleInfo">
...
...
...
I tried this:
$mtcDatum = preg_match("/[0-9]{2}/[0-9]{2}/[0-9]{4}/", $lnURL);
This returns an error message:
Warning: preg_match() [function.preg-match]: Unknown modifier '['
Why doesn't this work? I'm used to Linux's way of doing regex, does PHP handle regex differently?
...
I have been given a file that I would like to extract the useful data from. The format of the file goes something like this:
LINE: 1
TOKENKIND: somedata
TOKENKIND: somedata
LINE: 2
TOKENKIND: somedata
LINE: 3
etc...
What I would like to do is remove LINE: and the line number as well as TOKENKIND: so I am just left with a string that ...
In Python, I can do substring operations based on a regex like this.
rsDate = re.search(r"[0-9]{2}/[0-9]{2}/[0-9]{4}", testString)
filteredDate = rsDate.group()
filteredDate = re.sub(r"([0-9]{2})/([0-9]{2})/([0-9]{4})", r"\3\2\1", filteredDate)
What's the PHP equivalent to this?
...