i use a slideshow jquery plugin
which automatically create a thumbnails path from my original image path
as
follows
replace: [/(\.[^\.]+)$/, 't$1'],
whenever i have a blablablabla.jpg
it knows that the thumb path is the same path with t suffix blablablablat.jpg
but i want to change this to /thumb/blablablabla.jpg
how can i achieve ...
Whilst discussing the relative merits of using index() in Perl to search for substrings I decided to write a micro benchmark to prove what I had seen before than index is faster than regular expressions when looking for a substring. Here is the benchmarking code:
use strict;
use warnings;
use Benchmark qw(:all);
my @random_data;
for (1...
I am running a command which returns 96 .txt files for each hour of a particular date.
so finally it gives me 24*96 files for one day in a directory.
My aim is to extract data for four months which will result in 30*24*96*4 files in a directory.
After I get the data I need to extract certain "pattern" from each of the files and display...
From this string: "/resources/pages/id/AirOceanFreight.xhtml"
I need to retrieve two sub-strings: the string after pages/ and the string before .xhtml.
/resources/pages/ is constant. id and AirOceanFreight varies.
Any help appreciated, thanks!
...
How to exclude style attribute from HTML string with regular expressions?
For example if we have following inline HTML string:
<html><body style="background-color:yellow"><h2 style="background-color:red">This is a heading</h2><p style="background-color:green">This is a paragraph.</p></body></html>
When apply the regular expression mat...
I use the following rule to redirect pretty urls from http://hostname.co.za/geoip/123.12.123.34 to http://hostname.co.za/geoip/index.py?ip=123.12.123.34
.htaccess in /geoip
RewriteEngine on
RewriteRule ^(.*\..*\..*\..*)$ /geoip/index.py?ip=$1
This works fine to match only ip's, but when I try this, it gives a 500 server error:
Rewri...
Example
input: abc def abc abc pqr
I want to to replace abc at third position with xyz.
output: abc gef abc xyz pqr
Thanks in advance
...
Example:
((UINT32)((384UL*1024UL) - 1UL)) should return "UINT32"
(char)abc should return "char".
((int)xyz) should return "int".
...
Hi, I'm writing a search engine for my site and need to extract chunks of text with given keyword and few words around for the search result list.
I ended with something like that:
/**
* This function return part of the original text with
* the searched term and few words around the searched term
* @param string $text Original text
...
How to change case of some backreference in String.replace()? I want to match some part in text and change its case to upper/lower.
...
How would I make the following case insensitive?
if ($(this).attr("href").match(/\.exe$/))
{
// do something
}
...
I have a coupon request form on every page on my website, when the coupon form is submitted you are taken to the same page you are on with an additional "?coupon=sent" parameter added to the query string. I would like to be able to track any page url wiht ?coupon=sent on the end as a goal. Currently, I have this:
/[^.][.php][\?coupon...
I have some text I fetch inside here but only want the currency... How can I get rid of the other values?
I tried this, but didn't have any luck.
var symbol = $("div.price > h5 > div.num").text().replace(/[\d.]*/, "");
Here's the example html, the selector I'm using works fine, just not the replace.
<div class="price">
<h5 c...
I have a Perl regex. But I'm not sure what "?" means in this context.
m#(?:\w+)#
What does ? mean here?
...
Hi,
I am looking for validating a textbox in my asp.net application for a valid file path like
\\127.0.0.1\folder
http://ftp.google.com
and all other valid file paths
...
Regex test() is giving me issues in Firefox and Chrome, yet it works flawlessly in Opera and Safari.
troubled code:
var pattern = /(\s+(?!\$\w+)|(^(?!\$\w+)))/g;
if(pattern.test(String(id).replace(/\s+OR|AND\s+/g, ''))) {
searchError("You suck.");
return 1;
}
When you pass in white space, it blocks it every time. When you pass in s...
I know exact prefix of the String.
E.g. it is 'XXX000'
After the prefix, digits and chars in quantity of 60 go.
How to construct regexp this case?
In my initial understanding it should looks like:
(XXX000)(\w{*})
like:
prefix(some digits or some chars)
Thank you.
...
Hi,
I want PHP regex that can find errors on a page. So when I visit a site and crawl the page that I can list the errors on the site.
Currently I have the following code:
preg_match('/<b>.+<\/b>:.+ in <b>\/.+<\/b> on line <b>[0-9]+<\/b><br( \/)?>/msi',$html,$errors);
It can show if errors occurred, but it will not list them! I get ...
I am trying to search a varchar2 column in a table for matching strings using the value in another column. The column being searched allows free form text and allows words and numbers of different lengths. I want to find a string that is not part of a larger string of text and numbers.
Example: 1234a should match "Invoice #1234a" but no...
The following Regular Expression (url) pattern doesn't match the named group :
^/(.+?)/(.+)?(_p(?<Page>\d+))?
I don't know why this doesn't work in optional block:
?()?
What's the problem with this pattern and how can i get the correct result?
...