I'm currently making a few changes in the rTorrent source. I have the following code:
torrent::Object
apply_to_domain(const torrent::Object& rawArgs) {
const char * url = rawArgs.as_string().c_str();
char buffer[50];
snprintf(buffer, 50, "URL: %s.", url);
return std::string(buffer);
}
I need to extract the domain from url. Ther...
Hi,
From this questions : http://stackoverflow.com/questions/3073176/javascript-regex-only-letters-allowed
How can I make that expression test for people's name? Currently it doesn't allow spaces between names at all. I need to be able to match something like John Doe
Cheers
...
I have searched the site for this simple problem but cant find an answer.
I have a multiline string . I want to add a constant string to end of each line.
I am using Regex.Replace but facing problems. I tried to replace as the following.
Pattern Replace With
-------------------------------------------
$ ...
I saw other questions dealing with the finding the n-th occurrence of a word/pattern, but I couldn't find how you would actually substitute the n-th occurrence of a pattern in vim. There's the obvious way of hard coding all the occurrences like
:s/.*\(word\).*\(word\).*\(word\).*/.*\1.*\2.*newWord.*/g
Is there a better way of doing ...
given this text:
hello-world
I can match it with this regex:
hello\-.+?\b
The catch is if I have this:
hello-world-howyadoing
that second dash is consider a word boundary, so the match ends at 'world'
How do I say 'stop at next word boundary UNLESS that word boundary is a dash' in regex?
This is in .js, btw.
...
I'd like to parse the following string which is a time (HH:MM:SS): 00:00:00
Does anyone know how I can get the Hour, Minute, or Seconds values?
Thank you!
...
I'm trying to split up a string into two parts using regex. The string is formatted as follows:
text to extract<number>
I've been using (.*?)< and <(.*?)> which work fine but after reading into regex a little, I've just started to wonder why I need the ? in the expressions. I've only done it like that after finding them through this s...
Hi there
I have a problem: I am using TinyMCE for a text field. It all works fine until a user hits the enter button some times at the end of his input (new lines that are not needed). So for some inputs I save
<p>CONTENT</p><p> </p><p> </p>
or
<p>CONTENT</p><br /><br />
Since this input is displayed at other places of the webpag...
I want to replace word groups by links.
The word groups are defined in a multi-dimensional array. There will be thousands of terms to be replaced, so an unindexed, light-weight and multi-dimensional array is needed.
Nothing should be replaced when the term is followed by brackets or inside square brackets.
Problem:
The regex itself w...
I am beginner and have some problems with regexp.
Input text is : something idUser=123654; nick="Tom" something
I need extract value of idUser -> 123456
I try this:
//idUser is already 8 digits number
MatchCollection matchsID = Regex.Matches(pk.html, @"\bidUser=(\w{8})\b");
Text = matchsID[1].Value;
but on output i...
I have this string:
<own:egna attribute1="1" attribute2="2">test</own:egna>
I want to catch all attributes with a regexp.
This regexp matches one attribute: (\s+attribute\d=['"][^'"]+['"])
But why is it that appending a + like `(\s+attribute\d=['"][^'"]+['"])+ actually only returns the last matched attribute and not all of them?
How wo...
I want to set the Mask of MaskedtextBox from Regex expression. Such as i want a valid email, Decimal values and other regex expressions against a MaskedtextBox.
...
I'm trying to replace numbers of the form 4.2098234e-3 with 00042098234. I can capture the component parts ok with:
(-?)(\d+).(\d)+e-($d+)
but what I don't know how to do is to repeat the zeros at the start $4 times.
Any ideas?
Thanks in advance,
Ross
Ideally, I'd like to be able to do this with the find/replace feature of TextMat...
Given the code:
import clr
clr.AddReference('System')
from System.Text.RegularExpressions import *
def ReplaceBlank(st):
return Regex.Replace(
st,r'[^a-z\s](\s+)[^a-z\s]',
lambda s:s.Value.Replace(' ', ''),RegexOptions.IgnoreCase)
I expect the input ABC EDF to return ABCDEF but it doesn't work, what did I do wron...
I researched this quite a bit, but couldn't find a working example how to match nested html tags with attributes. I know it is possible to match balanced/nested innermost tags without attributes (for example a regex for and would be #<div\b[^>]*>(?:(?> [^<]+ ) |<(?!div\b[^>]*>))*?</div>#x).
However, I would like to see a regex patte...
In JavaScript, if I run the following code:
<script type="text/javascript">
var nameStr = 'Chris Kate Steve';
var names = nameStr.split(/[ ]/);
var names2 = nameStr.split(' ');
for (var i in names)
{
alert(i);
}
for (var i in names2)
{
alert(i);
}
</script>
It will alert:
0
1
2
index
input
For the f...
hi, I have the following string example:
PASSWORD = dsl3£$Roid
dfdfdf
fgdgfdfg
fgdfgdfg
dfgdfg
dfgdfgdfg
its stored in MySql Text field.
I need to get the "password" ie dsl3£$Roid
Its preceded by PASSWORD =
and there is a \n line break after. I can use nl2br to make the string like this:
PASSWORD = dsl3£$Roid<br>
dfdfdf<br>
fgdgfd...
Hello,
How can I write regular expression in which
whenever there is 0000 there should be 1111 after this for example:
00101011000011111111001111010 -> correct
0000110 -> incorect
11110 -> correct
thanks for any help
...
Hello guys,
Example url:
http://p.static.com/i/logo.jpg
I want to be able to extract the urls from my own CDN that are referenced in a string, extract the src url and from the src file and folders, so /i/logo.jpg, and then replace this with a hashed version, so any hashing function I may use like encode('/i/logo.jpg'). I'd like an ar...
I have the following regex:
RewriteRule ^blogs/([^/]*)/([^/]*) blogs/index.php?blogger=$1&blog=$2
This works fine for the following cases:
http://myurl.com/blogs/blog-name/blog-article/
http://myurl.com/blogs/blog-name/blog-article
http://myurl.com/blogs/blog-name/
however it does not handle:
http://myurl.com/blogs/blog-name
H...