validates_format_of :first_name, :with => /\A\w+\Z/
The validation doesn't pass if there are non-english character in first name, like Mölläinen. Changing Rails locale doesn't help. So how do you do culture/locale sensitive validation then?
If the locale is EN, then \w should map to [a-zA-Z0-9_], but if it's FI, then it should map to ...
I have a list of steps, and they are being echo'd into the view as li items in a ol.
So, I need to remove leading numbers (that look like ol { list-style: decimal }.
Here is an example array member
Combine 1 tbs oil...
I tried this regex
/^\d+\.\s*/
However, it didn't remove the 1. in the example above
But, when I remov...
i have regex code:
<script type="text/javascript">
var str = "kw-xr55und";
var patt1 = /[T|EE|EJU].*D/i;
document.write(str.match(patt1));
</script>
it can read:
str= "KD-R55UND" -> as UND
but if i type:
str= "kw-tc800h2und -> result tc-800h2und. //it makes script read T in front of 800
i want the result as UND ...
Hai, any can help me to change the "Wed Sep 29 14:47:37 +0000 2010" to "Sep 29,2010 at 2:47PM" using regular expression in PHP?
...
Hi,
If I am looking for a particular word inside a string, for example, in the string "how are you" I am looking for "are".
Would a regular indexOf() work faster and better or a Regex match()
String testStr = "how are you";
String lookUp = "are";
//METHOD1
if (testStr.indexOf(lookUp) != -1)
{
System.out.println("Found!");
}
//OR
//...
I need a regex or functions that will block user to post there private information . I have used regex but they by by pass it using patterns like email dot com , or [dot] or (doe). I need to block all there personal info like email, url , chat ids and telephone numbers . I have found few patterns which my members used most
"www, @, ....
I have two questions:
1) I have a regular expression ([A-Z][a-z]{0,2})(\d*) and I am using Python's re.finditer() to match appropriate strings. My problem is, that I want to match only strings that contain no extra characters, otherwise I want to raise an exception.
I want to catch a following pattern:
- capital letter, followed by 0,...
What's wrong in this expression?
echo preg_replace("/Condizioni/","ciao","<tr bla vla Condizioni");
It does not return anything...
Anyway It works when I remove "<" char...but I don't understand why...is it a special char, and if so what I i have to do to match it literally.
Thank you...
...
Hi All,
I have a text field have value http://localhost/Send/test.php?s/?a=1&o=2 . Another three text boxes . If we enter three values the above url will change like http://localhost/Send/test.php?s/?a=1&o=2&s1=a&s2=b&s3=c . The value for s1,s2 and s3 will not save anywhere . My question is how we check is the value ...
i have a string. there i need get a one word. this word is between space and point. for example
' 'word.
if it find many same pattern words, i need only first word.
...
Hi,
I want to split the string
String fields = "name[Employee Name], employeeno[Employee No], dob[Date of Birth], joindate[Date of Joining]";
to
name
employeeno
dob
joindate
I wrote the following java code for this but it is printing only name other matches are not printing.
String fields = "name[Employee Name], employeeno[Employ...
i have got a code to edit some function. There is a text box in that web application. It using a regular expression validator control to validate the text box. the validation expression is
ValidationExpression="[\w]{3,15}"
it accept all letters,numbers and underscores. but it do not accept special characters like \,/ * . i want to chan...
I have the following test which aims to ensure that file path generated is of a specific format. Using Nunit's fluent interfaces, how can I go about this?
I am having trouble with the regex.
[Test]
public void AssetControlPath_ShouldHaveFormat_BaseDir_YYYY_MMM_YYYYMMMDD()
{
//Arrange
var baseDir = "C:\\BaseDi...
I'm building a File manager with jQuery.
Users can create folders and upload files.
I need a Regual Expression (javascript) to check if the entered folder-name or the uploaded file-name is web-save. (no special chars or spaces are allowed)
The name should only contain alphanumeric values (a-z,A-Z,0-9), underscores (_) and dashes(-)
...
I'm trying to pull the first paragraph out of Markdown formatted documents:
This is the first paragraph.
This is the second paragraph.
The answer here gives me a solution that matches the first string ending in a double line break.
Perfect, except some of the texts begin with Markdown-style headers:
### This is an h3...
How can I grab the elements inside the parentheses and put them in a file?
me (I)
you (You)
him (He)
her (She)
Thanks in advance,
Adia
...
Hey,
I'm developing a CMS for a customer and he needs to edit stuff and use special characters such as ç and ®. However, I don't want him to have to enter the character codes like ®. Does anyone knows a good way to automatically convert those characters using PHP?
Thanks!
...
Hi,
Is it possible to replace all the special characters in a matlab vector through a regular expression?
Thank you
*EDIT: *
Thank you for your responses. I'm trying to achieve the following. I have a text file that contains few paragraphs from a novel. I have read this file into a vector.
fileText = ['Token1,' 'token_2' 'token%!3'...
I have a rewrite rule
RewriteRule ^([A-Za-z0-9\/\-\_]+)+$ .?p=$1 [L]
But if I have % sign in url, it won't work. How do I modify this rule to work with percentage sign?
...
I'm trying to find some compressed log files, and do some operations on them. I can't use ls because they are thousands of files in the directory and BASH throws a 'argument list too long' error.
This has brought me to find, but I'm having trouble with my regex.
Here is the whole find command
find $i -regex '.*logfile_MP[0-9]-GW0[0-9]...