There's a comment form where I'd want people to be able to write in foreign languages too.
But, for example, my spam-filtering mechanism would block something naiive as the word "été" simply because it has no vowels in it (english vowels that is).
My question is, when using regex for detecting vowels like:
$pattern = '/[aeiou]/';
I c...
Hi would it be possible to correctly split function attributes using regex ?
i want an expression that splits all attributes in a comma seperated list. But the attributes themselves could be an Array or Object or something that can also contain commas :
ex :
'string1','string2',sum(1,5,8), ["item1","item2","item3"], "string3" , {a:"tex...
I want to prevent this kind of typing:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbnonsense
for that I want to check that a certain letter gets repeated more than 9 times:
preg_match('/.{9,}/',$key)
but this would suit any word that has more than 9 letters in it, such as: supercalifregilisticexpealidocious
How do I do this?
...
I'm aware of the match, prematch, and postmatch predefined variables. I'm wondering if there is something similar for the evaluated replacement part of the s/// operator.
This would be particularly useful in dynamic expressions so they don't have to be evaluated a 2nd time.
For example, I currently have %regexs which is a hash of vari...
I have a database table with a column where every entry is a regular expression. For example, the rows in my table look like this:
table: email_address_templates
email_address: /*.google.com/
email_address: /*.reddit.com/
email_address: /*.ac.uk/
I want to be able to search through this table, and find if a particular string matches...
To find and replace all instances of a word in vim, I use
%s/word/newword/g
How do I change this so that it only finds instances of "word" that are whole words?
...
I have blocks of code that look like this:
<table border="0"><tr><td><img src='http://profile.ak.fbcdn.net/object3/686/9/q142163634919_249.jpg'/>&nbsp;&nbsp;</td><td>Gift of Life Marathon Blood Drive - "the group stood before a sea of 1,000 Long Trail Brewing Co. pint glasses..." (Rutland Herald, VT)</td></tr></t...
I want to accept a list of character as input from the user and reject the rest. I can accept a formatted string or find if a character/string is missing.
But how I can accept only a set of character while reject all other characters. I would like to use preg_match to do this.
e.g. Allowable characters are: a..z, A..Z, -, ’ ‘
User must ...
I have this regex:
preg_replace(
'/\["'.$key.'"\] = (.+?);/is', '["'.$key.'"] = '.$newValue.';',
$contents);
It writes an array value in a config file. I need to allow single or double quotes around the array key and I'm not sure how to do that. I didn't write this regex.
...
I need regular expression that converts links in plain text to HTML links.
Here are the following test links:
http://www.a-domain.com/something/?something
www.a-domain.com/something/?something
The regular expression should also work under the following assumptions:
Anything attached to the URL that isn't a part of the URL (a comma ...
Hi, I am trying to use regular expession in javascript but it is not working. My custom control contains property called RegEx which is provided by user and I need to validate the input value against this regex. As properties in JS will be in double quotes("") the regualr expression fails(case -1). Case 2 succeeds thought both the cases ...
How do I match and replace text using Regular expression in multiline mode?
I know the RegexOptions.Multiline option, but what is the best way to specify match all with the new line characters in C#.
Input:
<tag name="abc">this
is
a
text</tag>
Output:
[tag name="abc"]this
is
a
test
[/tag]
Edit: Aahh found the actual problem '&' an...
I've been working on a post editor, I want to generate thumbnails from all images inserted on the html code, so, before to do that I want to get all basic image attributes
example:
$mydomain = 'mysite.com';
$htmlcode = <<<EOD
<p>sample text</p>
<img src='/path/to/my/image.ext' width='120' height='90' />
<hr />
<img src='html://www.mys...
Trying to extract variable names from paths (variable is preceded with : ,optionally enclosed by ()), the number of variables may vary
"foo/bar/:firstVar/:(secondVar)foo2/:thirdVar"
Expected output should be:
['firstVar', 'secondVar', 'thirdVar']
Tried something like
"foo/bar/:firstVar/:(secondVar)foo2/:thirdVar".match(/\:([^/:]\w+...
I am trying to figure out a regular expression which matches any string which doesn't start with mpeg. A generalization of this is matching any string which doesn't start with a given regular expression.
I tried something like as follows:
[^m][^p][^e][^g].*
The problem with this is that it requires at least 4 characters to be present...
I have a ruby script that downloads URLs from an RSS server and then downloads the files at those URLs.
I need to split the URL into 2 components like so -
http://www.website.com/dir1/dir2/file.txt
--> 'www.website.com' and 'dir1/dir2/file.txt'
I'm struggling to come up with a way to do this. I've been playing with regular e...
I have a command to tidy up excessive whitespace in my code in vim:
" to tidy excess whitespace
map <leader>1 :execute ':%s#\s\+$##g'<CR>
My question is, if I have 10 tabs or buffers open, how can I apply this command to all of them, rather than just going to each one and applying the command.
Thanks,
Stephen
...
I'm writing a python program that deals with a fair amount of strings/files. My problem is that I'm going to be presented with a fairly short piece of text, and I'm going to need to search it for instances of a fairly broad range of words/phrases.
I'm thinking I'll need to compile regular expressions as a way of matching these words/phr...
I have the following search phrase and I need to extract
ABC XYZ
Mobile Accessories
Samsung 250
whenever they occur in the string in any order. The application is C# .Net.
Search Phrase
__________________________________________________________
ABC XYZ
ABC XYZ category:"Mobile Accessories"
category:"Mobile Accessories" ABC XYZ
A...
why this snippet:
'He said "Hello"' =~ /(\w)\1/
matches "ll"? I thought that the \w part matches "H", and hence \1 refers to "H", thus nothing should be matched? but why this result?
...