regex

How can I break an url and store the key-words into database using php

Like http:webmail.wipro.com#a:?b; I want to break this url and store only webmail and wipro into my database. Can any one help me out with this please. Using php. ...

C# - Regexp - ArgumentException

Hello, i want to match coordinates from a Browsergame. My Regex is: try { Regex r = new Regex("Mond ([1-9]) \x5B([1-9]):([1-9][0-9]{0,2}):([1-9][0-9]{0,2})\x5D"); Match m = r.Match("Mond 1 [1:1:1]"); } catch (ArgumentException ex) { Console.WriteLine(ex); ...

Regex with 'include' list and 'exclude' list

I have a sentence (words delimited by spaces). I then have two lists of phrases (full or partial words i.e. contain no spaces): one is an 'include' list and the other is an 'exclude' list. A matching sentence will contain all phrases in the 'include' list (overlaps are OK, case insensitive) and none of the phrases in the 'exclude' lis...

Opera 10, jquery with regex replace

Hi all. I have a jquery plugin that is working on all browsers, except opera. The removeHighlight function gets triggered, but the html is not changed. As far as I can see IE, FF, Chrome and Safari work as expected. My example can be found here: http://www.pritaeas.net/public/jquery/plugin-dev/ The plugin's url is: http://www.pritaeas....

How can i learn regex for ruby.

How can i learn regex for ruby? (for a dummie) ...

Easiest way to extract the urls from an html page using sed or awk only.

I want to extract the URL from within the anchor tags of an html file. This needs to be done in BASH using SED/AWK. No perl please. What is the easiest way to do this? Thanks a lot. ...

How to get Regex to ignore URL strings

Hi, I have the following Regexp to create a hash of values by separating a string at a semicolon: Hash["photo:chase jarvis".scan(/(.*)\:(.*)/)] // {'photo' => 'chase jarvis'} But I also want to be able to have URL's in the string and recognize it so it maintains the URL part in the value side of the hash i.e: Hash["photo:http://www...

Regular expression not matching specific string

My use case is as follows: I would like to find all occurrences of something similar to this /name.action, but where the last part is not .action eg: name.actoin - should match name.action - should not match nameaction - should not match I have this: /\w+.\w* to match two words separated by a dot, but I don't know how to add 'and do ...

In PHP, make every letter left of colon lowercase w/o use of explode,implode

Can this be done with regular expressions? Examples x-example-HEADER:teSt becomes x-example-header:teSt y-exaMPLE:testoneTWOthree becomes y-example:testoneTWOthree ...

return regex results to an array

I'm working on a little project and this is my first time using regex I've tried using .match or .matches but i don't see any option that will alow me to return the results of a regex query to an array. thanks ...

How do I build the boost "Getting Started" examples using XCode?

So let's say you want to build the Boost "Getting Started" examples and link to them using an Xcode project rather than building at the command line. You try the header-only option and it works fine. But then you take the example source: #include <boost/regex.hpp> #include <iostream> #include <string> int main() { std::string line...

Match comments containing a specific word

I want to match multiline comments that contain a specific word, let's say findthis. The first pattern that comes to mind is \/\*.*?findthis.*?\*\/ (using DOTALL). The problem with this pattern however is that a string like this: /* this is a comment */ this is some text /* this is a findthis comment */ will match the whole text. Basi...

mod_rewrite: Pass the path & query string URL as a parameter

I'm using mod_rewrite to rewrite pretty URLs to a form supported by a Spring 2.5 application. e.g. /category/cat1?q=x => /controller?category=cat1&q=x However from my controller I want to know the original URL the request came from (so I can generate a link if required). This approach is needed generically across all pages so it i...

RegEx- Check if its a masked number

I'm trying to find a regex that will check for a valid mask. The mask can contain as many * as it would like but it has to be followed by only 4 numbers. For example I would like these to pass: ********1234 ******1234 and these to fail: ********123 ********12345 ******12*34 ******1234* Thanks for your help. ...

Regex for non ANSI-style joins?

One of our rules is that all database joins have to be ANSI-style. As part of our build process I would like to scan all joins committed to source control for violations. I got a partial answer which I will post below but I'm sure its missing something and there must be a better one. Here is a non-comprehensive list of examples Shoul...

Parsing multilevel text list

I need to parse text lists: 1 List name 1 item 2 item 3 item 2 List name 1 item 2 item 3 item 3 List name 1 item 2 item 3 item I was trying to use regular expression to split first level list: import re def re_show(pat, s): print re.compile(pat, re.S).sub("{\g<0>}", s),'\n' s = ''' 1 List name 1 item 2 item 3 item 2 List nam...

How do I write a Regular Expression to match any non-empty content of an XML element that has no children elements?

I am trying to match elements that have no other children elements, but also have content. No content also includes whitespace and &nbsp; characters. I need to do this in C#. Take this XML for instance: <1> <2><3 /></2> <4> <5>This is match 1</5> </4> <6> </6> <7> &nbsp;&nbsp;&nbsp;&nbsp; ...

RewriteRule (mod_rewrite)

What does that rewrite rule mean? RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] Sorry, even after reading the mod_rewrite syntax explanation, I didn't get it... :-/ Can someone explain me what that rule(s) does. Thanks a lot. ...

Apache RewriteCond to Lighttpd

I want to migrate some sites running on apache to Lighttpd. Can anyone help me to convert this Rewrite rule into a equivalent rule for Lighttpd: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] I'm reading the Lighttpd rewrite explanation (http://redmine.lighttpd.net/...

Pattern Error while using RegEx in Java

Hi All, I am stuck up with a problem while using Regular Expression. My requirement is : split a long string into maximum size of 125 letters and then insert a line break in between them. while splitting, it shouldn't split between the words. in short, i want to split a string into small strings whose length is 125 or at the end of word...