I need you help here.
I want to turn this:
sometext sometext http://www.somedomain.com/index.html sometext sometext
into:
sometext sometext <a href="http://somedoamai.com/index.html">www.somedomain.com/index.html</a> sometext sometext
I have managed it by using this regex:
preg_replace("#((http|https|ftp)://(\S*?\.\S*?))...
Hello guys,
What I need is to parce my projects' resource files and change its version number. I have a working JS script but I would like to implement it with python.
So, the problem stands in using re.sub:
version = "2,3,4,5"
modified_str = re.sub(r"(/FILEVERSION )\d+,\d+,\d+,\d+(\s)/g", version, str_text)
I understand that becaus...
Using System.Text.RegularExpressions with the following expression to match all tokens wrapped with # that contain only text (no whitespace etc)
#([a-zA-Z]+)#
and the following test string
text #test# text #test1# text
I only get one match. What am I doing wrong in my regex?
...
Hi,
I am searching for a way to model a RegEx which would give a match for both of these strings when searched for "sun shining".
the sun is shining
a shining sun is nice
Thx
...
I have a list of tags:
>>> tags_list
['tag1', 'second tag', 'third longer tag']
How can I replace whitespaces within each element of the list with "+" ? I was trying to do this with regular expressions but each string remains unchanged:
for tag in tags_list:
re.sub("\s+" , " ", tag)
What is wrong with my approach ?
EDIT:
Yes ...
Basically I attempting to extract the last tag name of a handful of different css selectors.
I have successfully implemented what I am talking about in javascript, I'm looking for a more compact way using only 1 regex expression preferably.
Here is what I successfully have working.
//Trim selector, remove [attr] selectors due to confl...
Is there a way to do this in one line?
my $b = &fetch();
$b =~ s/find/replace/g;
&job($b)
...
I want an nginx location directive that would match all urls with "xyz" and not match ".php"
I tried this
location ~* /(.*)xyz/(.*)(?!\.php)(.*)$ {}
but for example it always seem to match both /xyz/1 and /xyz/1.php but it should have matched only /xyz/1
...
I have the following regex:
my $scores_compiled_regex = qr{^0
\s+
(\p{Alpha}+\d*)
\s+
(\d+
\s*
\p{Alpha}*)
...
I have this working regex (tested on regex coach):
\n[\s]*[0-9]*[\s]*[0-9]*(\.)?[0-9]*(e\+)?[0-9]*
that is supposed to pick up the first 2 columns of this file
http://wwwhomes.uni-bielefeld.de/achim/highly.txt
I read through the man pages, and it says that ^ will match at the beggining of the line so I replaced \n with ^
but egrep i...
in many languages there can be many possibilities to assing a string to a variable:
var = "some 'quoted' string"
var = 'some "quoted" string'
var = `some 'quoted "quoted" string`
var = somestring
Of course in this last variant the space is not possible and end of string is marked by some special character like ; space or > in html.
B...
is there a way to search within a browser (with any of them) using regular expression? Let's say I want to search for either "python" or "php" I don't want to have to do this twice. Ideally, this could be done within the regular GUI, but if not, using add-ons/plug-ins with Web Inspector (webkit) or Firebug is fine too. Thanks!
...
input line is below
Item(s): [item1.test],[item2.qa],[item3.production]
Can you help me write a Java regular expression to extract
item1.test,item2.qa,item3.production
from above input line?
...
This drives me crazy, it should be easy but I can't...
I need to rewrite URLs like this ones:
www.domain.com/foo/bar/more/evenmore.htm
www.domain.com/foo/bar/more.htm
www.domain.com/foo/bar.htm
www.domain.com/foo.htm
into:
www.domain.com/?var1=foo&var2=bar&var3=more&var4=evenmore
www.domain.com/?var1=foo&var2=bar&var3=more
www.domai...
Meaning, I want to match:
$10
or
$
but not this:
${name}
or:
$image{http://wrfgadgadga.com/gadgad.png}
I also want to match everything else... normal characters, symbols, numbers, etc.
Matching everything but things that start with $ is easy. It's like this:
def literalCharacter: Parser[String] = """[^\$]""".r
I've tried ...
I have a file that is supposed to be \n\n delimited, but of course its not. Some of the lines contains spaces after the \n\n. How do I find a remove all spaces after a \n\n that starts a new line but that is before any other character.
Sample:
\n\nData,Mo re,Data
\n\n Some,Li st,Of
\n\n\nOther,St uff
\n\n\n\n This is another
D...
Hello,
I have text which shows course numbers, names, grade and other information for courses taken by students. Specifically, the lines look like these:
0301 453 20071 LINEAR SYSTEMS I A 4 4 16.0
0301 481 20071 ELECTRONICS I WITH LAB A 4 4 16.0
0301 481 20084 ELECTRONICS II WITH LAB...
I'm trying to write a regex in php that in a line like
<a href="mypage.php?(some junk)&p=12345&(other junk)" other link stuff>Text</a>
and it will only return me "p=12345", or even "12345". Note that the (some junk)& and the &(otherjunk) may or may not be present.
Can I do this with one expression, or will I need more than one? I can...
how can i split them into an array of items, i.e. array[0] = "ABC ", array[1] = "YXYZ", array[2] = " " array[3]= " 123 " ...
Regular Expression Gurus! Help!
Don't care about performance, only code terseness, i.e. nifty unreadable code is totally fine.
EXTRA CREDIT:
I really want to do this --> everything in [ ] needs to basically for...
I would like a Perl regex that matches any contiguous subset of the string '12345'.
I'm probably just having a brain-freeze, but this is my test code and current best regex. I can see how to brute-force the situation by adding alternatives, but I'm wondering which elegant alternative I'm missing. [I don't specifically need captures fo...