I would like to be able to extract a number from within a string formatted as follows:
"<[1085674730]> hello foo1, how are you doing?"
I'm a novice with regular expressions, I only want to be able to extract a number that is enclosed in the greater/less-than and bracket symbols, but I'm not sure how to go about it. I have to match num...
Hello all,
I have a lot to learn as far as regular expressions are concerned.
I have an associative array like so:
array(
"label"=>"Special",
"title"=>"Category",
"onclick"=>"dosomething()",
"options"=>array(
"one"=>"something"
)
)
I am trying to use preg_match_all on the array like so:
$match="on*";
fo...
Code:
var myPattern:RegExp = /\"/;
trace(a.replace(myPattern, "\\\""));
<TEXTFORMAT LEADING=\"2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0B333C" LETTERSPACING="0" KERNING="0">sdfdsfdsf</FONT></P></TEXTFORMAT>
above im using that regular expression to escape the " in the string. however it only does it for the first ...
Hi,
I am trying to tokenize a string using the pattern as below.
>>> splitter = re.compile(r'((\w*)(\d*)\-\s?(\w*)(\d*)|(?x)\$?\d+(\.\d+)?(\,\d+)?|([A-Z]\.)+|(Mr)\.|(Sen)\.|(Miss)\.|.$|\w+|[^\w\s])')
>>> splitter.split("Hello! Hi, I am debating this predicament called life. Can you help me?")
I get the following output. Could someone...
Forgive me for the beginner regex question but I was hoping that someone could show me how to get the youtube id out of a url regardless of what other GET variables are in the URL.
Use this video for example:
http://www.youtube.com/watch?v=C4kxS1ksqtw&feature=related
so between v= and before the next &
...
Say for example I want to take this phrase:
{{Hello|What's Up|Howdy} {world|planet} |
{Goodbye|Later}
{people|citizens|inhabitants}}
and randomly make it into one of the following:
Hello world
Goodbye people
What's Up word
What's Up planet
Later citizens
etc.
The basic idea is that enclosed within every pair of braces will b...
Hi all I have the following Regx that can't be accepted on the JavaScript
if ($(caller).attr('value').toString().search('/(?=\D*\d\D*\d).{8,15}/g') == -1)
where
$(caller).attr('value').toString() = "fdsddfsd45"
it returns to me -1
also I'm try to test it from pattern
if (!pattern.test($(caller).attr('value'))) {
where
patte...
Hi,
I'm a complete noob to regex and I need help with splitting a string. I am inputing the following data
665 11% R 1 908K 388K fg root top
61 1% S 42 152404K 29716K fg system system_server
38 0% S 1 840K 340K fg root /system/bin/qemud
114 0% S 16 120160K 19156K fg radio com.andro...
Hi,
I have a regular expression that searches for the special characters.
When I do a search on numerics, e.g. 3, I always get 0, when I'd expect to get -1.
'3'.search(/[!\"£\$%\^&\*\(\)-_\+=\[\]\{\};:@\'#\\|<,\.>\/\?]/)
Any idea why is this happening?
...
I want to parse the output of a serial monitoring program called Docklight (I highly recommend it)
It outputs 'hexadecimal' strings: or a sequence of (two capital hex digits followed by a space). the corresponding regular expression is: ([0-9A-F]{2} )+ for example: '05 03 DA 4B 3F '
When program detects particular sequences of character...
I am trying to do a replace within a string in PHP. How do you delete the part that is only in the group in PHP?
<font.+?(size.+?.)>
I want to remove size=x where ever it in. The problem is I cannot get the
$text = preg_replace("<font.+?(size.+?.)>","",$text);
function to work.
Example source of this
<font style="background...
Hello
I've a basic URL validation in my appliction. Right now i'm using the following code.
//validates whether the given value is
//a valid URL
function validateUrl(value)
{
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(value);
}
But right now it is not a...
Let's say I have some text that has the pattern as shown by the four lines of text below:
foo.bar.gar
foo.bar.gar.har.mar.tar.dar.zar.daddy.whatever.mummy.whateverelse
foo.hoo.scoobydoobydoo.yay
sunday.monday
The only two things known about the pattern are that:
There will be at least 1 pair of words separated by a dot (period); and...
Hi there,
I'm making an XMLParser for a Java program (I know there are good XMLParsers out there but I just want to do it).
I have a method called getAttributeValue(String xmlElement, String attribute) and am using regex to find a sequence of characters that have the attribute name plus
="any characters that aren't a double quote"
I...
Pretty much what the question says. I came up with
(ba)?(a + bb + bbbbb + aba)*(ab)?
Is there anything more readable? Or is this incorrect?
I know you shouldn't really be doing this sorta thing with Regex when you can just go !~/bbb/ in your code, but it's a theory exercise.
Thanks.
Edit for Clarification: I'm not using | to repre...
I have the following regular expression to find word in text and highlight them
Using the word surface for testing purposes.
/((?<=[\W])surface?(?![\w]))|((?<![\w])surface?(?=[\W]))/iu
It matches all occurences in the following text.
surface-CoP-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_surface_Tare surface_revC.pdf...
Hi
I am working on mail client application. I want to show all HTTP links as clickable hyper links.
I have noticed that some clients are sending HTTP links without enclosing them inside the anchor tags. In this case I am failing to show those links as clickable links.
My requirement is to find all HTTP links in a HTML mail and need...
Hello all,
I saw this statement
$name = ereg_replace("[^A-Za-z0-9.]", "", $name);
What is the difference between [^A-Za-z0-9.] and [A-Za-z0-9.]?
Based on my understanding of regular expression, the [] is used to include all valid characters for replacment in function ereg_replace.
Then what is the purpose of including ^ into the []...
Is there an easy way to do the equivalent in jquery or jscript for that matter.
NewString = Regex.Replace(SOMESTRING, "[^a-z0-9A-Z -]")
...
I have a string that contains html markup like links, bold text, etc.
I want to strip all the tags so I just have the raw text.
What's the best way to do this? regex?
...