I'm looking for a greedy RegEx match to replace all text in a number of HTML files between </title> and </head> (I've combined loads of JavaScript files to minimize the number of http requests).
I've googled it but the majority of the solutions don't seem to work for me. (Which naturally leads me to assume that i'm wrong)
This is my ...
Hey there!
I'm having a bit of a problem trying to validate email adresses using preg_match (or eregi() if that suits better). I've tried several regex patterns now and no matter what i do it doesn't seem to work.
Here's the function:
function validateEmail($email) {
if(eregi('[a-z||0-9]@[a-z||0-9].[a-z]', $email)){
retur...
I have the following string in database:
SET @Value = "[4888378977CA4A5] Test String"
Also, the @Value may also have 'RE: ' at the start of the string such as:
SET @Value = "RE: [4888378977CA4A5] Test String"
How can I access the 4888378977CA4A5 part of the string using regular expressions?
Thanks!
...
Hello everyone,
The situation is as follows: I have a series of big, fat PDF files, full of imagery and randomly distributed text - these are the sections of a huge promotional pricelist for a vast array of products. What I need is to pattern-match all the catalogue codes in the text of each PDF file and to wrap it with a hyperlink that...
I have a one liner in vim which I regularly use for find and replace.
I now want to use it to remove tags - something like this but I looks like I need to escape the / I'm not sure what am I missing.
:%s~<Validator>*</Validator>~~g
...
$a = "<no> 3232 </no> "
$a =~ s/<no>(.*)</no>/000/gi ;
I am expecting that $a becomes "<no> 000 </no> ", but it is not working.
...
I have an inline markup editor built into my website, which should produce XHTML compliant markup. But as you can see, it uses the deprecated font tag and size attribute.
<font style="font-family: Courier New; color: rgb(0, 0, 153);" size="2">
asdfa
<span style="color: rgb(0, 51, 0);">
a
<font size="5">fds</font>
</sp...
i have a small problem, i want to find in <tr><td>3</td><td>foo</td><td>2</td> the foo, i use: $<tr><td>\d</td><td>(.*)</td>$ to find the foo, but it dont work because it dont match with the </td> at the end of foo but with the </td> at the end of the string
...
In my answer to this question, I mentioned that we used UpperCamelCase parsing to get a description of an enum constant not decorated with a Description attribute, but it was naive, and it didn't work in all cases. I revisited it, and this is what I came up with:
var result = Regex.Replace(camelCasedString,
...
I'm trying to highlight a match in a string by inserting <b> tags around the matching substring. For example, if the query is "cat" then:
"I have a cat."
should become:
"I have a <b>cat</b>."
Likewise, if the query is "stack overflow", then:
"Stack Overflow is great."
should become:
"<b>Stack Overflow</b> is great."
In other...
I need help trying to write a JavaScript regular expression to select Harry and Anderson from this text:
H6 Harry - Anderson
So I want the word after the hyphen and word before the hyphen.
...
Is it possible to get all regular expression matches in PHP? I need a script that will, for example, match .+ in abc and give the result:
Array(a, b, c, ab, bc, abc)
...
In learning Regular Expressions it had me wondering how the underlying engine works. Probably more specifically, I'd like to know more about how it evalutates, prioritizies and parses the expression. I feel the RegEx engine is a blackbox to me, and I would really enjoy deciphering it.
So I'd like to ask if there are some great resourc...
I am looking for a PHP regex to check a string is:
4 characters long
the 1st character is A-Z (capitalized alphabet)
the 2nd to 4th characters are numbers (0-9)
A good example is: A123
Thanks!
...
Hey guys, I've been trying to parse through HTML files to scrape text from them, and every so often, I get some really weird characters like à€œ. I determined that its the "smart quotes" or curly punctuation that is causing the all of my problems, so my temporary fix has been to search for and replace all of these characters with their c...
Looking for a regex to check a valid English name, i.e.:
A-Z, a-z, space only
First name, (optional) Middle name, Last name
An acceptable example: John von Neumann
Thanks!
EDIT (added checking code):
#!/usr/bin/php
<?php
function check_name($regex, $name)
{
$rc = 'Bad';
if (preg_match($regex, $name)) { ...
I have a particular PHP page that I want to conditionally do things only if the visitor is not a search engine. Are there some good regex to match $_SERVER['HTTP_USER_AGENT']?
Or would it be better to do a javascript redirect back to the page but set a flag, since search engines don't have javascript? (I don't have to worry much about m...
I am having trouble building a regular expression with the set of strings over {a, b, c} that is an odd length with exactly one a. Here is my best attempt so far:
(bb|bc|cb|cc)*a(bb|bc|cb|cc)*
This does good for even b and c on either side of the a, but does not account for a odd b and c combination on either side of the a.
Any hint...
Hi Experts,
I am studying about regular expression and struck with the
lookaround concept
and
with few syntax.
After doing googling, I thought it is a right forum to ask for help.
Please help with this concept.
As I am not good with understanding the explanation.
It will be great if I get plenty of different examples to underst...
Hello.
If filename has another characters then this `a-zA-Z0-9!@$%^,.`
we must replace them in some character or delete.
...