Hi, I am currently internationalizing my site using PHP and ran into this problem. Some string have multiple links in them so I would like to put the links in wrappers to make it easier for translators to translate (since I'm using gettext). For example:
The <a href="google.com">dog</a>, <a href="bing.com">cat</a>, and <a href="yahoo....
var src = "http://blah.com/SOMETHING.jpg";
src.replace(/.*([A-Z])\.jpg$/g, "X");
at this point, shouldn't src be:
http://blah.com/SOMETHINX.jpg
If I use match() with the same regular expression, it says it matched. Regex Coach also shows a match on the character "G".
...
I'm trying to write a regex function to remove onclick (also onload, onmouseover etc.) attributes from HTML elements. I want to do this on the server side before the HTML is sent to the client.
I have content coming from a Rich Text editor and being displayed on screen in a div, and I want to protect against XSS (Cross Site Scripting). ...
Hello, hopefully this should be a quick and simple one, using PHP I'm trying to split a string into an array but by only the last instance of whitespace. So far I have...
$str="hello this is a space";
$arr=preg_split("/\s+/",$str);
print_r($arr);
Array ( [0] => hello [1] => this [2] => is [3] => a [4] => space )
...which split...
Is there a PHP function that can escape regex patterns before they are applied?
I am looking along the lines of the C# Regex.Escape function.
...
What's the best scripted way to delete (near) duplicate files based on filespec in Windows (XP in this case)? I am thinking of RegEX and some VB Script but if there is a better way...
Examples include filenames that slighlty differ in name either with one or two (known) extra characters at the end or beggining but are identical in size,...
How can you find the repetiting sequences of at least 30 numbers?
Sample of the data
2.3758542141230068337129840546697038724373576309794988610478359908883826879271070615034168564920273348519362186788154897494305239179954441913439635535307517084282460136674259681093394077448747152619589977220956719817767653758542141230068337129840546697...
Hi,
I have this string:
\tid [email protected]; Tue, 6 Oct 2009 15:38:16 +0100
and I want to extract the date (emboldened) to a more usable format, e.g. 06-10-2009 15:38:16
What would be the best way to go about this?
thanks in advance
leddy
...
I have a hunch that I should probably be using ack or egrep instead, but what should I use to basically look for
<?
at the start of a file? I'm trying to find all files that contain the php short open tag since I migrated a bunch of legacy scripts to a relatively new server with the latest php 5.
I know the regex would probably be '/...
I have a long string. What is the regular expression to split the numbers into the array?
...
I have a model like this:
class CampaignPermittedURL(models.Model):
hostname = models.CharField(max_length=255)
path = models.CharField(max_length=255,blank=True)
On a frequent basis, I will be handed a URL, which I can urlsplit into a hostname and a path. What I'd like is for the end user to be able to enter a hostname (yaho...
I know there are a few regex/lastIndex discrepancies but this one is new to me!
Expected behaviour: Creating a new regular expression (with literal/constructor) will, obviously, create a new RegExp object with a lastIndex property set to zero.
Actual behaviour: (in FF, Chrome): The lastIndex property seems to persist through multiple R...
So i have a regex pattern, and I want to generate all the text permutations that would be allowed from that pattern.
Example:
var pattern = "^My (?:biological|real)? Name is Steve$";
var permutations = getStringPermutations(pattern);
This would return the list of strings below:
My Name is Steve
My real Name is Steve
My biological ...
I going to admit that I am hopeless at writing regular expressions. So can anyone please offer assistance in writing an expression (in C#) that will match the following cases:
value(Plugin.Tests.Business.Services.Repositories.Maps.SomeTests+<>c__DisplayClass2).
value(Plugin.Tests.Business.Interfaces.SomeOtherClass+<>c__DisplayClass3).
...
I want to scrape data from HTML.
The data I want is "Health Niche blogs". What regex to write?
fo width="80%" noWrap>Author: Health Niche Blogs | Published: Se
...
I am using Yahoo Pipes to take a twitter feed and filter information out. Pipes' regex function is a replace ______ with ____ iteration.
My example is:
Testbedots: happy "twins"
I am trying to find a regex string that will select everything but what is within the double quotations. I am assuming there will only be one set of quot...
I always thought that a look-behind assertion in Java's regex-API (and many other languages for that matter) must have an obvious length. So, STAR and PLUS quantifiers are not allowed inside look-behinds.
The excellent online resource regular-expressions.info seems to confirm (some of) my assumptions:
"[...] Java takes things a step...
I'm setting up some conversion funnels on Google Analytics. One is to analyse traffic going from the main site to a secondary promotional site running on a virtual directory (on the same domain though)
I should add, this is a setup form in Google Analytics, I can't using another other code (PHP, JS, C# etc) and it has to be done in one ...
Hiya,
I've got an order form, to which I can append fields by clicking a button. I've got some back end javascript running which totals up the order price, but the grand total script is eluding me.
My problem is that I need the script to seach the entire DOM and find how many have an ID which matches the following pattern.
totprice0...
What is need is given the following string "Other Text [[MyText]] Some Other Text", and given some specific characters like "[[" for start and "]]" for end, to be able to match "[[MyText]]".
Given the following regex = "(\[\[)(.*)(\]\])" I am able to match what I want, but not exactly.
Lets say I have this string "Other Text[[ Somethin...