What would the regex expression that would go into preg_split function to validate date in the format of
7-Mar-10 or how can I validate a date of format 7-Mar-10 in PHP
Thanks.
Hi.
Tumblr and other blogging websites allows people to post embeded codes of videos from youtube and all video networks.
but how they filter only the flash object code and remove any other html or scripts? and even they have an automated code that informes you this is not a valid video code.
Is this done using REGEX expressions? And Is there a PHP class to do that?
Thanks
Hello, please, does any of you knows and can share an easy/clean way to find a substring within a string, but ignoring some specified characters to find it.
I think an example would explain things better:
string: "Hello, -this- is a string"
substring to find: "Hello this"
chars to ignore: "," and "-"
found the substring, result: "Hello, -this"
Using Regex it's not a requirement for me, just added the tag because it feels related.
Hi
with linux bash shell , how can i use regex to get a certain string of a file
by example:
for filename *.tgz
do
"get the certain string of filename (in my case, get 2010.04.12 of file 2010.01.12myfile.tgz)"
done
or should I turn to perl
Merci
frank
Hi,
I've got this regex (I'm not good at it) /http://www.youtube.com/watch?v=[a-zA-Z0-9_]/i it has to match any youtube watch url (because youtube always redirects to that domain)... It should match http://www.youtube.com/watch?v=iMXCqgWjpL8 but it doesn't.
Can someone help me?
Regard,
dodo
I have the following regex expression which is to extract the source of any img tag in HTML.
/(<img).*(src\s*=\s*"([a-zA-Z0-9\.;:\/\?&=\-_|\r|\n]{1,})")/isxmU
However, it doesn't appear to be matching the following:
<IMG SRC='http://www.mysite.com/pix/lens/mtf/CAEF8512L.gif'>
How can I build it to match this as well?
I know that the following regex will match "red", "green", or "blue".
red|green|blue
Is there a straightforward way of making it match everything except several specified strings?
I have a string like so:
option_alpha="value" option_beta="some other value" option_gamma="X" ...etc.
I'm using this to parse them into name & value pairs:
preg_match_all("/([a-z0-9_]+)\s*=\s*[\"\'](.+?)[\"\']/is", $var_string, $matches)
Which works fine, unless it encounters an empty attribute value:
option_alpha="value" option_beta="" option_gamma="X"
What have I done wrong in my regex?
I have a variable $link_item, it's used with echo and gives the strings like
<span class="name">Google</span>http://google.com
How to remove "<span class="name">Google</span>" from string?
It should give just "http://google.com".
Heard it can be done with regex(), please help.
Hi Guys,
I have a bit of php code like this:
$test = "<!--my comment goes here--> Hello World";
Now i want to strip the whole html comment from the string, i know i need to use preg_replace, but now sure on the regex to go in there.
Can anybody help?
Thanks
I want a regex to find the following types of strings:
http://anything.abc.tld
http://anything.abc.tld/
where
abc - abc always remains abc
anything - it could be any string
tld - it could be any tld (top-level-domain) like .com .net .co.in .co.uk etc.
Note: The url must not contain any other thing at the end, means http://anything.abc.tld/xyz is not acceptable.
Trying to use regex refind tag to find the content within the brackets in this example using coldfusion
joe smith <[email protected]>
The resulting text should be
[email protected]
Not having any luck. Any suggestions?
Regex is absolutely my weak point and this one has me completely stumped. I am building a fairly basic search functionality and I need to be able to alter my user input based on the following pattern:
Subject:
%22first set%22 %22second set%22-drupal -wordpress
Desired output:
+"first set" +"second set" -drupal -wordpress
I wish I could be more help as I normally like to at least post the solution I have so far, but on this one I'm at a loss.
Any help is appreciated. Thank you.
My string contain a lot of HTML entities, like this
"Hello <everybody> there"
And I want to split it by HTML entities into this :
Hello
everybody
there
Can anybody suggest me a way to do this please? May be using Regex?
I am using python and would like a simple api or regex to check for a domain name's validity. By validity I am the syntactical validity and not whether the domain name actually exists on the Internet or not.
Alright so I want to grab the information on a website thats between
[usernames] and [/usernames]
I know how to get the string but how would I use regex to only have the information in the middle.
Remember I am going to be having more then one thing on the page.
Hi to all,
if I have a string like 'foo(bar)', with the following code i can almost parse it the way i want:
$results = array();
preg_match( "/\w*(?=(\(.*\))?)/", 'foo(bar)', &$results );
print_r($results);
/*
Array
(
[0] => foo
[1] => (bar)
)
*/
How can I modify the regex to have bar instead of (bar)? Thanks
I have a variable $link_item, it's used with echo and gives the strings like
<span class="name">Google</span>http://google.com
How to remove "<span class="name">Google</span>" from string?
It should give just "http://google.com".
Heard it can be done with regex(), please help.
I would like to extract some text between two points in a string, in Javascript
Say the string is
"start-extractThis-234"
The numbers at the end can be any number, but the hyphens are always present.
Ideally I think capturing between the two hypens should be ok.
I would like the result of the regex to be
extractThis
Is there any difference in speed/memory usage for these two equivalent expressions:
Regex.IsMatch(Message, "1000")
Vs
Message.Contains("1000")
Any situations where one is better than other ?
hi
i'm really not used to the split string method in c# and i was wondering how come there's no split by more than one char function?
and my attempt to try to split this string below using regex has just ended up in frustration.
anybody can help me?
basically i want to split the string below down to
aa**aa**bb**dd^__^a2a**a2a**b2b**dd^__^
into
aa**aa**bb**dd
a2a**a2a**b2b**dd
and then later into
aa
aa
bb
dd
a2a
a2a
b2b
dd
thanks!
In C# what's the best way to remove blank lines i.e., lines that contain only whitespace from a string? I'm happy to use a Regex if that's the best solution.
I need a way to convert a number into formatted way by inserting comma at suitable places. Can it be done using regex?
Example:
12345 => 12,345
1234567 =>1,234,567
I'm having some troubles getting regex to replace all occurances of a string within a string.
**What to replace:**
href="/newsroom
**Replace with this:**
href="http://intranet/newsroom
This isn't working:
str.replace(/href="/newsroom/g, 'href="http://intranet/newsroom"');
Any ideas?
Thanks,
Tegan