regex

regex no character

In this text: warning here there are several types of warnings in this string warning.gif at the end warning end of line warning I want to match every warning except warning.gif. I cannot seem to get it to include the last one that has no character (control or otherwise) after it. using warnings?[^\.] gets what I want except for th...

Cleanup Perl code: my $export = $doc; $export =~ s:\.odt:\.pdf:;

Perl code fragment: my $export = $doc; $export =~ s:\.odt:\.pdf:; How would this be written cleaner? Not simply what are 900 other ways to write it, TMTOWTDI. ...

Url rewriting a Regex help.

What Regex do I need for match this url: Match: 1234 1234/ 1234/article-name Don't match: 1234absd 1234absd/article-name 1234/article.aspx 1234/any.dot.in.the.url ...

How can I get the nickname and message from raw IRC data in vb.net

Well basically I've got a vb.net script connecting to IRC, and I'm working on making it a basic chat system, but I've run into a problem. Say I receive this: :[email protected] PRIVMSG #channel :message I want to grab specific information to output to the user. I want to grab nickname and message How can ...

php function to make slug (url string)

function gen_slug($str){ # special accents $a = array('À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ý','ÿ','A','a','A','a','A','a','C','c','C','c','...

How do I insert format str and don't remove the matched regular expression in input string in boost::regex_replace() in C++?

I want to put space between punctuations and other words in a sentence. But boost::regex_replace() replaces the punctuation with space, and I want to keep a punctuation in the sentence! for example in this code the output should be "Hello . hi , " regex e1("[.,]"); std::basic_string<char> str = "Hello.hi,"; std::basic_string<char> fmt ...

get specific part from url

hi, my window.location is "F:/html5/home.html", from my location i need to get the file name like this "home.html", to do this, how to i use the regular expression command? any one help me? ...

Highlight current page in jquery

Hi, I have the 12 html pages. and all this pages are loads when the left navigation bar link clicked. in this, i need to add a class to the current link, which is clicked and loaded the page. i tried with this: $(function(){ $('#container li a').click(function(){ $('#container li a').removeClass('current'); var pat...

Replace ",**" with a linebreak using RegEx (or something else)

I'm getting started with RegEx and I was wondering if anyone could help me craft a statement to convert coordinates as follows: 145.00694,-37.80421,9 145.00686,-37.80382,9 145.00595,-37.8035,16 145.00586,-37.80301,16 to 145.00694,-37.80421 145.00686,-37.80382 145.00595,-37.8035 145.00586,-37.80301 (Strip off the last comma and val...

finding and returning a string with a specified prefix

I am close but I am not sure what to do with the restuling match object. If I do p = re.search('[/@.* /]', str) I'll get any words that start with @ and end up with a space. This is what I want. However this returns a Match object that I dont' know what to do with. What's the most computationally efficient way of finding and returnin...

regular expression search and replace

Hello This is some code <br /> <br /> <br /> <br /> <br /> <br /> but I want replace <br /> fourth with <hr /> And this output <br /> <br /> <br /> <hr /> <br /> <br /> Please help me ...

Php regular expression to match a div

Hello all <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> <div id="c"> Bar </div> I want find all object in id="a" and out put is <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> Geat thanks. ...

Text replace with regex in SQL Server

Currently I have a SQL server column of type nvarchar(max) which has text that starts with <span class="escape_<<digits>>"></span> The only thing that varies in the pattern is the <<digits>> in the class name. The common part is <span class="myclass_ and the closing </span> Some sample values are <span class="myclass_12">...

i want check input by regex | contain 16 number

I have input, I want to check it. It should accept only numbers, and must be 16, no more and no less. How I can do that using php and regex? ...

Decompose a Python string into its characters

I want to break a Python string into its characters. sequenceOfAlphabets = list( string.uppercase ) works. However, why does not sequenceOfAlphabets = re.split( '.', string.uppercase ) work? All I get are empty, albeit expected count of elements ...

Replacement of text using JavaScript

i want to replace some selected character from my text-area with some string. To do this i wrote the following JavaScript code var old_tag = "["; var tag= " <xsl:value-of select = "; var endtag= " />"; var txt=''; if(document.selection) { txt = document.selection.createRange().text document.selection.creat...

Need a regular expression for an Irish phone number

I need to validate an Irish phone number but I don't want to make it too user unfriendly, many people are used to writing there phone number with brackets wrapping their area code followed by 5 to 7 digits for their number, some add spaces between the area code or mobile operator. The format of Irish landline numbers is an area code of ...

redirecting directories with a few exceptions using .htaccess and mod_rewrite

I'm using mod_rewrite in a ManagedFusion settings file (similar to .htaccess) and I want to forward all incoming requests to another port on the server, except for a few folders. So far I have this (with the folder ui, forms, clientsystem and widgets being ignored) RewriteEngine On RewriteCond %{REQUEST_URI} !ui$ RewriteCond %{REQUE...

What is wrong with this substitution?

#!/usr/bin/perl use strict; use warnings; my $s = "sad day Good day May be Bad Day "; $s =~ s/\w+ \w+/_/gm; print $s; I am trying to substitute all spaces between words with _, but it is not working. What is wrong with that? ...

How to change source order of <div> in less steps/automatically?

How can I do this task automatically. I need to change source order of the divs, which has same id in above 100 pages. I created an example: This is default condition <div class="identification"> <div class="number">Number 1</div> </div> <div class="identification"> <div class="number">Number 2</div> </div> <div class="identificat...