regex

Match text only with word characters

Hi, so I want to check if all characters in text are \w or \s if yes then true if even one character isn't \w or \s then false. How can it be done?:) Language: javascript ...

Extract two double Values from String using RegEx in Java

I am reading a file by line and need to extract latitude and longitude from it. This how lines can looks: DE 83543 Rott am Inn Bayern BY Oberbayern Landkreis Rosenheim 47.983 12.1278 DE 21147 Hamburg Hamburg HH Kreisfreie Stadt Hamburg 53.55 10 What's for sure is, there are no dots surrounded by digits e...

find and replace values in a flat-file using PHP

I'd think there was a question on this already, but I can't find one. Maybe the solution is too easy... Anyway, I have a flat-file and want to let the user change the values based on a name. I've already sorted out creating new name+value-pairs using the fopen('a') mode, using jQuery to send the AJAX call with newValue and newName. But s...

Question about regex in linux commands.

I ran the following command at linux bash: apt-cache search hex.*(view|edit) My intention was to find any software packages whose name/description contains the pattern 'hex.*(view|edit)'. But among the results I got this: kipi-plugins - image manipulation/handling plugins for KIPI aware programs How could this be in the results lis...

emacs: is there a way to specify a case-insensitive search in a regexp?

In Javascript, I just need to append a i to the regexp to make it case-insensitive. In .NET, I use a RegexOptions.IgnoreCase. I know about case-fold-search. What I want is to specify that behavior in the regex itself, as specified in an elisp program. Possible? ...

How to use regex to strip [a-z]/[a-z]/ from a string?

Say a string is abc/xyz/IMPORTANT/DATA/@#!%@!%, and I just want IMPORTANT/DATA/!%#@%!#% I am terrible at regex, and really haven't learned JavaScript API yet ...

spring security filter-chain regex pattern

In my application which uses spring security I want to define two different areas both using their own spring security filter-chain. My question is: is it possible to define two regex expressions as follows: every path starting with /foobar/* every other path not starting with /foobar The important part here is that the second path ...

C# Regex replace url

I have a bunch of links in a document which has to be replaced by a javascript call. All the links looks the same: <a href="http://domain/ViewDocument.aspx?id=3D1&amp;doc=form" target="_blank">Document naam 1</a> <a href="http://domain/ViewDocument.aspx?id=3D2&amp;doc=form" target="_blank">Document naam 2</a> <a href="http://domain/View...

regular expression remove comment tag

I want remove html commnent tag <!--QuoteEnd--></div><!--QuoteEEnd--> <!--hide me-->Abc<!--hide me--> after remove </div> Abc ...

Optimizing python link matching regular expression

I have a regular expression, links = re.compile('<a(.+?)href=(?:"|\')?((?:https?://|/)[^\'"]+)(?:"|\')?(.*?)>(.+?)</a>',re.I).findall(data) to find links in some html, it is taking a long time on certain html, any optimization advice? One that it chokes on is http://freeyourmindonline.net/Blog/ ...

JavaScript regex - positive lookahead -- giving me syntax errors

This piece of regex (?<=href\=")[^]+?(?=#_) is supposed to match everything in a href value except the the hash value and what follows it within the href url. It appears to work fine under Regex debuggers/testers such as http://gskinner.com/RegExr/ but in javascript it appears to produce syntax error. If i remove the < from the (?<=) it ...

How to find all javascript on page with php given url?

In php how would I grab all javascript from a page given it's url? Is there a good regular expression to get the src of all javascript script tags or the script inside of them? ...

@Path and regular expression (Jersey/REST)

Hi there! I'm using Jersey in a REST project and I'm needing to use regular expression. Digging about it is simple like: @Path("/resources) public class MyResource { @GET @Path("{subResources:.*}") public String get(@PathParam("subResources") String subResources) {...} } But, doing like this, the method is getting the requ...

Regex to match . (periods marking end of sentences) but not Mr. (as in Mr. Hopkins)

I'm trying to parse a text file into sentences ending in periods, but names like Mr. Hopkins are throwing false alarms on matching for periods. What regex identifies "." but not "Mr." For bonus, I'm also using ! to find end of sentences, so my current Regex is /(!/./ and I'd love an answer that incorporates my !'s too. ...

VB.net Regex Get Information

Well I am currently trying to get the word/text in between these 2 things : and ! I tried this Dim nick As String = String.Empty Dim p = ":(?<ircnick>.*?)!" Dim Matches = Regex.Matches(mail, p, RegexOptions.IgnoreCase Or RegexOptions.Singleline) If Matches IsNot Nothing AndAlso Matches.Count > 0 Then ...

regex using vb.net

hi, i have this html code <div class="name"> <span id="businessNumOnMap2" class="resultNumberOnMap" style="display:none;">2</span> <span> <a href="/len/aapproximatch%20search/284096.php" onclick="loadBusinessInfo('1', '284096'); return false;" class="businessName">Bangsar Seafood Garden Restaurant</a></span><span id="phoneSpan1">...

getting all of the image absolute path in a page?

I am trying to get the src of all of the images in a page. But some pages use absolute paths and some do not. So I am wondering whats the best way to do this? right now I am using this. $imgsrc_regex = '#<\s*img [^\>]*src\s*=\s*(["\'])(.*?)\1#im'; preg_match_all($imgsrc_regex, $html, $matches); For example webpage a might have the i...

validating the mobile numbers

I need a regular expression to validate the mobile number up to 9 digits, if the telephone number starts with 8 otherwise 10 digits needs to be entered. The numbers must start either with 9 or 8 with above criteria. ...

Getting dialogue snippets from text using regular expressions

I'm trying to extract snippets of dialogue from a book text. For example, if I have the string "What's the matter with the flag?" inquired Captain MacWhirr. "Seems all right to me." Then I want to extract "What's the matter with the flag?" and "Seem's all right to me.". I found a regular expression to use here, which is "[^"\\]*(\\.[...

regular expression for emails NOT ending with replace script

I'm currently modifying my regex for this: http://stackoverflow.com/questions/2782031/extracting-email-addresses-in-an-html-block-in-ruby-rails basically, im making another obfuscator that uses ROT13 by parsing a block of text for all links that contain a mailto referrer(using hpricot). One use case this doesn't catch is that if the us...