I am not very good at regex, but I need to convert the following example from this
<li>Creations by Carol - www.driedfloralcreations.com</li>
to
<li>Creations by Carol - <a href="http://www.driedfloralcreations.com" rel="external">www.driedfloralcreations.com</a></li>
...
I'm trying to find all the hash tags in a string. The hashtags are from a stream like twitter, they could be anywhere in the text like:
this is a #awesome event, lets use the
tag #fun
I'm using the .NET framework (c#), I was thinking this would be a suitable regex pattern to use:
#\w+
Is this the best regex for this purpose?
...
I'm having a problem with PHP PCRE, and I'm used to POSIX, so I'm not too sure about what I'm doing wrong. Basically, this function is matching up to 10 numbers separated by commas. However, it's also matching the string sdf (and probably many others), which I don't see the reason for. Can anyone help me?
$pattern='^\d{0,5},? ?\d{0,5},?...
My brain's flooding. Really thanks to all who already helped yesterday.
(If I add anything to the thread of yesterday, it's not shown by the newest questions?)
Maybe someone can try to help again; it's so important for me :S
<ul>
<li>
07.05.2009:
<a href="#1">Test 1</a>
</li>
<li>
05.01.2009:
<a href="#2">Test 2</a>
</li>
</ul>
This ...
In Oracle's regexp_replace function, there is a parameter replace_string in which you can specify backreferences \1 to \9.
Is there a way to refer to backreferences after the 9th one? Oracle treats \10 as \1 followed by a literal 0.
...
Hello!
I'd like to mimick (reproduce) Expression Engine's fantastic template parsing method. (Pls don't ask me why not using it :))
While i'm able to find and parse simple tags like
{example_param = "param_value"}
i cannot parse tags where closing tag added:
{cyclic_param}
...
{/cyclic_param}
This is the pattern i'm using:
'/[\{...
From this question: http://stackoverflow.com/questions/1524377/what-regex-pattern-do-i-need-for-this I've been using the following code:
function process($node, $replaceRules) {
if($node->hasChildNodes()) {
foreach ($node->childNodes as $childNode) {
if ($childNode instanceof DOMText) {
$text = preg_replac...
another question of me about regular expression, its so complicated for me :S So I'm happy for an additional help.
I have a table and I like to read all links inside this table and split it to groups.
The goal should be
Person 1
Status of person 1
Person 2
Status of Person 2
So i have to get the values inside the links in this...
I've a regex that matches comma separated numbers with an optional two digit decimal part in a given multiline text.
/(?<=\s|^)\d{1,3}(,\d{3})*(\.\d{2})?(?=\s|$)/m
It matches strings like 1, 12, 12.34, 12,345.67 etc successfully. How can I modify it to match a number with only the decimal part like .23?
EDIT: Just to clarify - I woul...
I have the following string:
StartProgram 1 ""C:\Program Files\ABC\ABC XYZ"" CleanProgramTimeout 1 30
I need a regular expression to split this line but ignore spaces in double quotes in Perl.
The following is what I tried but it does not work.
(".*?"|\S+)
...
I am beginning work on a large Visual Studio solution, and have come across areas that have large blocks of commented-out code. The blocks are usually more than 3 lines in length, and all start with // (probably Ctrl+K,C was used to comment these out). I would like to try to find out all the places these exist in my solution so our tea...
I am trying to extract some words from a string. The two cases look like this:
Case 1: "Group X - Ford Mondeo or similar"
Case 2: "Group X - Ford Mondeo"
I would like a single .NET regex that captures "Ford Mondeo" in both cases.
The best I have so far is:
^Group [A-Z] - (?<VehicleModel>.+)(?: or similar)$
which returns:
Case 1: "F...
This is the regular expression I use to match phone numbers like:
00 00 00 00 00
00 00 0 00 00 00 00
+00 0 00 00 00 00
(\d{2}\s+\d{2}\s+\d{2}\s+\d{2}\s+\d{2})\s+(\d{2}\s+\d{2}\s+\d\s+\d{2}\s+\d{2}\s+\d{2}\s+\d{2})\s+(+\d{2}\s+\d\s+\d{2}\s+\d{2}\s+\d{2}\s+\d{2})
I have tried to include it into my javascript but It's not really working...
I am using Perl to parse out sizes in a string. What is the regex that I could use to accomplish this:
Example Data:
Sleepwell Mattress (Twin)
Magic Nite (Flip Free design) Mattress (Full XL)
Result:
Twin
Full XL
I know that I need to start at the end of the string and parse out the first set of parenthesis just no...
While working on a huge form for a client I realized that the majority of the regex validators I had were for the same regex:
^[^<>]*$
It's an easy way to prevent HTML entry into of TextBox controls.
I was curious if anyone else had a regex that they used more often or if there's one that I should be using instead of this one.
...
How can I tell m4's patsubstr to replace all newlines in a string with a space?
I've tried:
patsubst(MULTI_LINE_STR_DEFINE,`\n',` ')
and
patsubst(MULTI_LINE_STR_DEFINE,`\\n',` ')
...
The task I was trying to accomplish was that given an input pattern, e.g. 1 2 3 3 2 4 2 1, to go through a dictionary and find words that fit the given pattern. In my code, I tried taking the given string and converting it to a regular expression like so:
(?<1>.)(?<2>.)(?<3>.)(\k<3>)(\k<2>)(?<4>.)(\k<2>)(\k<1>)
(Before anyone start...
I want to remove all lines in a CSS file that contain the word "color".
This would include:
body {background-color:#000;}
div {color:#fff;}
How would you do that using the :%s/ command?
...
I'm trying to use textpad to search for a regular expression in several files.
it's a simple pattern but it doesn't work in textpad. It works fine in Visual Studio.
Anyone have any ideas?
searching for: hosted.mysite.com or host.mysite.com
using
(hosted|host).mysite.com
...
I have a string that look something like
something30-mr200
I would like to get everything after the mr (basically the # followed by mr) *always there is going to be the "-mr"
Any help will be appreciate it.
Thanks
...