I'll preface this question by mentioning that while I'm far from a regular expressions guru, they are not completely foreign to me. Building a regular expression to search for a pattern inside a particular string generally isn't a problem for me, but I have a (maybe?) unique situation.
I have a set of values, say:
028938
DEF567987...
This may be a lame question but I am a total novice with regular expressions. I have some text data in the format:
Company Name: Name of the company, place. Company Address: Some,
address, here. Link:
http://www.somelink.com
Now, I want to use a regex to split these into an array of name : value pairs. The regular expression...
I'm working on a RoR project and I am passing a JSON object to a script. Specifically, a list of events to a jquery calendar.
First I get the necessary events from active record and convert them to json:
@events = CalendarEvent.find(:all, :conditions => ["mentor_id = ?", current_user]).to_json(:only => [:id, :availability, :starts_at,...
Hello, I am new to php and am asking for some coding help. I have little experience with php and have gone to the php.net site and read couple books to get some ideas on how to perform this task.
There seems to be many functions and I am confused on what would be the best fit. (i.e. fgetcsv, explode(), regex??) for extracting data in t...
Is it possible to exclude <pre> tags from this code igniter compression hook? I don't understand regular expressions well enough to not break my page. I have tried, but it always jacks up the output.
EDIT: This CodeIgniter Compression hook strips all unecisary white space and formatting from the code in order to compress the output. ...
How can I match something using jquery that is set up as such:
id="intersection_resources_4_5" // hit
id="intersection_content_6_5" // hit
id="intersection_content_4_3" // not
I want to do something like:
$("div:regex(id, intersection_*_*_5)").each(function(){
$(this).click();
});
Is this doable? Assuming, the * is a wildcard,...
In Perl, working with a paragraph of text in one big long string with no line breaks, how can I use a split and RegEx (or something else) to split the paragraph into chunks of around the same size at a word boundary, for display in a monospaced font?
For example, how do I change this:
"When you have decided which answer is the most hel...
I need a regex that matches
re.compile('userpage')
href="www.example.com?u=userpage&as=233&p=1"
href="www.example.com?u=userpage&as=233&p=2"
I want to get all urls that have u=userpage and p=1
How can I modify the regex above to find both u=userpage and p=1?
...
Hi Folks!
I'm trying to pass an URL as a parameter in mod-rewrite. I guess there is a problem in my Regex. This my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule **^go/((http:\/\/)+[A-Za-z0-9\-]+[\.A-Za-z])/?$** feedmini.php?url=$1 [L]
</IfModule>
the URL I want to pass looks like http://www.aaaa.com/aaa/?q=v but ...
preg_replace("/(/s|^)(php|ajax|c\+\+|javascript|c#)(/s|$)/i", '$1#$2$3', $somevar);
It's meant to turn, for example, PHP into #PHP.
Warning: preg_replace(): Unknown modifier '|'
HALP
...
I'm trying to write some matching rules in a Vim syntax file to highlight indented bullets. My problem is that the syntax highlighting uses a background color, so I would like to match only the bullet character and not the preceding whitespace.
How can I say "match \d., +, -, and * only if preceded by ^\s\{0,1} (but do not match the wh...
I'm working on a regexp to find and replace all matches that don't start with url(http
relative paths are going to be converted to full absolut paths
ie:
url(foo/bar) > url('http://foo/bar')
match:
url(foo/bar)
url('foo/bar')
don't match:
url(http://foo/bar)
url('http://foo/bar')
This is what I've come up with so far, but I'm n...
I'm using PHP 5's preg functions, if it makes a difference.
Consider the regular language matched by the following regular expression.
([^{}] | {[0-9a-zA-Z_]+})*
The language consists of strings of any number of characters, with special embedded tags marked off by left and right curly brackets, which contain a string of one or more a...
Dim r As String
If r.Contains("src") Then
r.Replace("src=\""", "")
'r.Replace("src='{0}'", "src='http://google.co.in'")
End If
Response.Write(r.ToString())
Response.End()
...
I would like to get the links from the search results. Can someone please help with with the regular expression to do this? I've got this, and it doesn't work:
preg_match_all("/<h3(.*)><a href=\"(.*)\"(.*)<\/h3>/", $result, $matches);
...
Hi,
In another question I learned how to calculate straight poker hand using regex (here).
Now, by curiosity, the question is: can I use regex to calculate the same thing, using ASCII CODE?
Something like:
regex: [C][C+1][C+2][C+3][C+4], being C the ASCII CODE (or like this)
Matches: 45678, 23456
Doesn't matches: 45679 or 23459 (no...
I am trying to extract all substrings in a string that is between the strings /* and */. I know this will probably need to be done with regular expressions however I'm having a hard time getting the correct regex since the star character is actually used to symbolise repeated characters. I'm am trying to use the preg-match method in PHP ...
Sigh, regex trouble again.
I have following in $text:
[img]http://www.site.com/logo.jpg[/img]
and
[url]http://www.site.com[/url]
I have regex expression:
$text = preg_replace("/(?<!(\[img\]|\[url\]))([http|ftp]+:\/\/)?\S+[^\s.,>)\];'\"!?]\.+[com|ru|net|ua|biz|org]+\/?[^<>\n\r ]+[A-Za-z0-9](?!(\[\/img\]|\[\/url\]))/","there was l...
This is some sample text from a large text file.
(2, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(3, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(4, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(5, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(6, 1, 3, 2, 'text...','other text.....
I have an HTML snippet like this :
<a href="XXXXXXXXXXXXXXX" target="_blank" class="view_job_link">View or apply to job</a>
I want to read href value XXXXXXXXXX using Java.
Point to note: I am reading the HTML file from a URL using inputstreamreader(url.openStream()).
I am getting a complete HTML file, and above snippet is a part of...