I've got a bunch of web page content in my database with links like this:
<a href="/11ecfdc5-d28d-4121-b1c9-1f898ac0b72e">Link</a>
That Guid unique identifier is the ID of another page in the same database.
I'd like to crawl those pages and check for broken links.
To do that I need a function that can return a list of all the Guids ...
A friend asked me this and I was stumped: Is there a way to craft a regular expression that matches a sequence of the same character? E.g., match on 'aaa', 'bbb', but not 'abc'?
m|\w{2,3}| wouldn't do the trick as it would match 'abc'.
m|a{2,3}| wouldn't do the trick as it wouldn't match 'bbb', 'ccc', etc.
...
I have a script where I need to get three parts out of a text string, and return them in an array. After a couple of trying and failing I couldn't get it to work.
The text strings can look like this:
Some place
Some place (often text in parenthesis)
Some place (often text in parenthesis) [even text in brackets sometimes]
I need to spl...
I try to get an "/" to every urls end:
example.com/art
should
example.com/art/
I use nginx as webserver.
I need the rewrite rule for this..
For better understanding check this:
http://3much.schnickschnack.info/art/projekte
If u press on a small thumbnail under the big picture it reloads and shows this url:
http://3much.schnicks...
Hi,
I am very new to regex, and this is way too advanced for me. So I am asking the experts over here.
Problem
I would like to retrieve the constants / values from a php define()
DEFINE('TEXT', 'VALUE');
Basically I would like a regex to be able to return the name of constant, and the value of constant from the above line. Just TEXT...
Hi,
Can somebody tell me what I am doing wrong really? I am going nuts, the following code works perfect on localhost/WIN and when I try it on the webhost/linux it gives warnings:
$lines = file('english.php');
foreach($lines as $line) {
$matches=array();
if (preg_match('/DEFINE\(\'(.*?)\',\s*\'(.*)\'\);/i', $line, $matches)) {
...
Using a regex, I am able to find a bunch of numbers that I want to replace. However, I want to replace the number with another number that is calculated using the original - captured - number.
Is that possible in notepad++ using a kind of expression in the replacement-part?
Edit: Maybe a strange thought, but could the calculation be do...
I was answering some quiz questions for an interview, and the question was about how would I do screen scraping. That is, picking content out of a web page, assuming you don't have a better structured way to query the information directly (e.g. a web service).
My solution was to use an XQuery expression. The expression was fairly long...
How can I split correctly a string containing a sentence with special chars using whitespaces as separator ?
Using regex split method I cannot obtain the desired result.
Example code:
# -*- coding: utf-8 -*-
import re
s="La felicità è tutto" # "The happiness is everything" in italian
l=re.compile("(\W)").split(s)
print " s> "+s
prin...
I'm looking for an open-source text editor which allows cross-line regular expression search and replace.
Thus, for example replacing \n with \n-------------------\n , and so introduce a dashed line between lines.
Or I could search for 08\nERROR and find
INFO 9329 21 June 2008
ERROR 3832 21 June 2008
UltraEdit has this feature, but ...
We know that VB string start and end with double quotes " "
So we have to use "" if we want " in VB string.
I wonder if there is a regular expression pattern which will match VB string?.
Thanks.
...
Is there a regex pattern that will match a string that contains repeated pattern, e.g.:
"a"|"b","c"|"d",...,"y"|"z"
Do you have any idea?
Thanks.
...
I have two datalists. One works like a menu where you click on a link to fill the othe datalist.
I also have added a next and previous linkbutton to move between the different "pages" so that you do not have to change using the menu datalist.
Now in code behind depending on which values I get from the database I add a RegularExpressionV...
Hey everybody,
This is a quickly cooked up script, but I am having some difficulty due to unfamiliarity with regexes and Perl.
The script is supposed to read in an HTML file. There is a place in the file (by itself) where I have a bunch of <div>s. I want to remove every third of them -- they are grouped in fours.
My script below won...
Writing a quick app to help me filter text files.
I'm reading in a text file line-by-line, and need to match a series of characters that looks like this: 090129 YBB 100
The first set, 090129, will be 6 numbers (0-9). Followed by a space, and then YBB - always. After that, another space, then 2-3 numbers (0-9).
This pattern will alway...
I use Nokogiri (Rubygem) css search to look for certain <div> inside my html. It looks like Nokogiri's css search doesn't like regex. I would like to switch to Nokogiri's xpath search as this seems to support regex in search strings.
How do I implement the (pseudo) css search mentioned below in an xpath search?
require 'rubygems'
requi...
How do I split a string with multiple separators in JavaScript? I'm trying to split on both commas and spaces but, AFAIK, js's split function only supports one separator.
...
When using re.sub, how to you handle a situation where you need a capture followed by a number in the replacement string? For example, you cannot use "\10" for capture 1 followed by a '0' character because it will be interpreted as capture 10.
...
I'm trying to write a regular expression to identify an if statement. The only problem I'm having is getting it capture if statements that have parentheses in their parenthesis. For example:
if (condition_function(params)) {
statements;
}
My expression to capture all if statements except these is:
if\s*\(([^\(\)]|\s)*\)\s*{(.|\...
The app I am writing deals with utility service addresses, and right now I am forcing the user to know enough to separate the parts of the address and put them in the appropriate fields before adding to the database. It has to be done this way for sorting purposes because a straight alphabetical sort isn't always right when there is a p...