php getting substring from a string.
I have the next URL: http://domen.com/aaa/bbb/ccc. How can I get the string after http://domen.com/? Thanks a lot. ...
I have the next URL: http://domen.com/aaa/bbb/ccc. How can I get the string after http://domen.com/? Thanks a lot. ...
How do you replace all of the characters in a string that do not fit a criteria. I'm having trouble specifically with the NOT operator. Specifically, I'm trying to remove all characters that are not a digit, I've tried this so far: String number = "703-463-9281"; String number2 = number.replaceAll("[0-9]!", ""); // produces: "703-46...
Despite the ridiculously large number of regex matching engines for Haskell, the only one I can find that will substitute is Text.Regex, which, while decent, is missing a few thing I like from pcre. Are there any pcre-based packages which will do substitution, or am I stuck with this? ...
I am trying to do a search and replace with variables. In this case variables that I pulled from a previous match. Here is my code: $fileContentToAlter =~ s/$2/$1/g; Now I realize in that state, it is being read incorrectly as $ has its own meaning inside of a regexp. I did some searching on the web and read that doublequotes could fi...
I have about 50 html documents and I need to replace the text between <!DOCTYPE and <!-- start content --> with <?php require("header.php"); ?> From what I've read, Notepad++ does not support multiple line regular expressions but I thought I might put that in the question too. I'm new to regular expressions so I need someone to tel...
Hello, I need to parse a html file and extract the NeedThis* strings with C#/.net, sample code is: <tr class="class"> <td style="width: 120px"> <a href="NeedThis1">NeedThis2</a> </td> <td style="width: 120px"> <a href="NeedThis3"> NeedThis4</a> </td> <td style="width: 30%"> NeedThi...
I have some strings that I would like to pattern match and then extract out the matches as variables $1, $2, etc. The pattern matching code I have is a = /^([\+|\-]?[1-9]?)([C|P])(?:([\+|\-][1-9]?)([C|P]))*$/i.match(field) puts result = #{a.to_a.inspect} With the above I am able to easily match the following sample strings: "C",...
How do I make a Javascript regular expression that will take this string (named url_string): http://localhost:3000/new_note?date1=01-01-2010&date2=03-03-2010 and return it, but with the value of the date1 parameter set to a new date variable, which is called new_date_1? ...
I've got text from which I want to remove all characters that ARE NOT the following. desired_characters = 0123456789!&',-./abcdefghijklmnopqrstuvwxyz\n The last is a \n (newline) that I do want to keep. ...
For regex what is the syntax for search until but not including? Kinda like: Haystack: The quick red fox jumped over the lazy brown dog Expression: .*?quick -> and then everything until it hits the letter "z" but do not include z ...
What does the plus symbol in regex mean? ...
Hello, I'm using the Rails 3 nav plugin simple-navigation: http://github.com/andi/simple-navigation In the configuration file you can setup a regex to determine what element gets the ".selected" class. Example: primary.item :projects, 'Projects', project_path, :class => "sideNav-main", :highlights_on => /\/projects/ The above work...
I've a string like "Colors: yellow, green, white". I need to get an array ("yellow", "green", "white") from it and it needs to be done with one regex. I'm trying to apply something like var result = Regex.Match("Colors: green, white, yellow", @":(\s(?<result>.*?)(,|$))*"); what I get is that result.Groups["result"]=="yellow" How ca...
Hi ! Let say I have set of characters [a-z] I want to match every character from the set, except character "a" Thanks ! ...
Hi . I wrote some RegExp pattren like this : SomeText But I want the pattren to match with : Sometext sOMeTeXt SOMETEXT SoMEteXt Somethings like that ! In fact I want to use this \s?[^a-zA-Z0-9\_]SomeText[^a-zA-Z0-9\_] what should i do ? ...
I've written a regex... internal static readonly Regex _parseSelector = new Regex(@" (?<tag>"+_validName+@")? (?:\.(?<class>"+_validName+ @"))* (?:\#(?<id>"+_validName+ @"))* (?<attr>\[ \])* (?:\:(?<pseudo>.+?))* ", RegexOptions.IgnorePatternWhitespace); Now I want to get all the...
I've got a regex... internal static readonly Regex _parseSelector = new Regex(@" (?<tag>" + _namePattern + @")? (?:\.(?<class>" + _namePattern + @"))* (?:\#(?<id>" + _namePattern + @"))* (?<attr>\[\s* (?<name>" + _namePattern + @")\s* (?: (?<op>[|*~$!^%<>]?=|[<>])\s* (?<quote>['""]...
Hello fellow developers, I tried searching for the answer to this, but I couldn't find anything too helpful in this situation. It's possible that I'm not searching the correct terms. I'm having trouble with this regex. Consider this string: $str = "(1, 2, 'test (foo) bar'), (3, 4, '(hello,world)')"; I want to end up with a multi...
i have a text file which contains lots of email addresses from my old address book. I need to get these out of it. every email addy is preceeded with ip: and ends with \ for example blablablaip:[email protected]\ the addresses are up to 25 characters in length(not sure if that makes a difference for the required regex im a noob) and ...
i test re on some pythonwebshelll, all of them are encounter issue if i use a=re.findall(r"""<ul>[\s\S]*?<li><a href="(?P<link>[\s\S]*?)"[\s\S]*?<img src="(?P<img>[\s\S]*?)"[\s\S]*?<br/>[\s\S]*?</li>[\s\S]*?</li>[\s\S]*?</li>[\s\S]*?</ul>""",html) print a it's ok but if i use a=re.findall(r"""<ul>[\s\S]*?<li><a href="(?P<link>[\s\...