The reply in my post states that pattern "*@he.com" is not a "correct regexp". Actually, it is not a regex at all, rather wildcard, things like:
find . -iname ".gi*"
The above example in Regex would be
find . -iname "\.gi.*"
Questions about Regex and Wildcards
How can I use only Regex instead of wildcards?
Where do you really n...
I'm trying to use regular expressions to match a string that does not contain the sequence of characters of a less than symbol (<) followed by a non space. Here are some examples
Valid - "A new description."
Valid - "A < new description."
Invalid - "A <new description."
I can't seem to find the right expression to get a match. I'm usi...
Max Length of the String is 6.
The string should contain at most 2 digits
The string should contain at most 4 alphabets
So the following examples should match
abcd22
a1cd3d
11acde
a1c
1ad
...
I am using Java regexes in Java 1.6 (inter alia to parse numeric output) and cannot find a precise definition of \b ("word boundary"). I had assumed that "-12" would be an "integer word" (matched by \b\-?\d+\b) but it appears that this does not work. I'd be grateful to know of ways of matching space-separated numbers.
Example:
Pat...
How would I parse the following input (either going line by line or via regex... or combination of both):
Table[
Row[
C_ID[Data:12345.0][Sec:12345.0][Type:Double]
F_ID[Data:17660][Sec:17660][Type:Long]
NAME[Data:Mike Jones][Sec:Mike Jones][Type:String]
]
Row[
C_ID[Data:2560.0][Sec:2560.0][Type:Double]...
Hi,
I'm working on a program where I need to match a regular expression and a string. The string is pretty simple actually but I'm having problems with my current regex (I'm using the .net regex engine)
My current regular expression is "^[VvEeTtPp][^a-zA-Z0-9\s]\d{0,12}?$"
Now, the string I want to match always follows this pattern
...
My simple date validation regex is not working correctly...
validates_format_of :dob, :with => /\d{2}\/\d{2}\/\d{4}/, :message => "^Date must be in the following format: mm/dd/yyyy"
What am I missing here? I'm trying to validate that a date is in the following format: mm/dd/yyyy - When I enter what should be valid data, I still get th...
Hi, Assuming I've been given the following string to match against:
#sidebar h1 ul li{ #a:hover; height : 100px ;color: #fffff ; font-family: @fonts; }
What I want is to only match whitespaces within the curly braces { } that are not enclosed on both sides by words.
My current regex looks like this:
( (?!\w)|(?<!\w) )
But it match...
If i want to change the below
Hello
To:
HELLO
Its fine when i do \(Hello)\
But it dosent work for words such as:
HeLLo hello HellO
Is there any way i can get regex to pick all hello characters?
...
I'm using the following query with regexp:
SELECT a.id, a.company, a.name, b.title, b.description, b.t_id
FROM a, b
WHERE ( b.title
REGEXP "[[:<:]]a.company[[:>:]]" OR b.description
REGEXP "[[:<:]]a.company[[:>:]]" OR b.title
REGEXP "[[:<:]]a.name[[:>:]]" OR b.description
REGEXP "[[:<:]]a.name[[:>:]]" ) AND a.company != '' AND a.name ...
We have been using regex for our grammar requirement. However there are about 20+ patterns that needs to be supported and maintaining RegEx has become very difficult when the patterns started becoming recursive. We tried migrating to ANTLR, and looked at the following two critical points required for us.
Performance
Performance seems...
The following code results in "undefined" for lastIndex:
var a = /cat/g;
var l = "A test sentence containing cat and dog.";
var r = a.exec(l);
document.write(r.lastIndex);
However, it works perfectly for r.index (and r.input).
I am using Firefox. Does anybody have a clue?
EDIT: OK, the above code works perfectly in IE! Further,...
I'm in the processing of converting a program from Perl to Java. I have come across the line
my ($title) = ($info{$host} =~ /^\s*\(([^\)]+)\)\s*$/);
I'm not very good with regular expressions but from what I can tell this is matching something in the string $info{$host} to the regular expression ^\s*(([^)]+))\s*$ and assigning the mat...
hello,
I want a regular expression to extract the title from a HTML page. Currently I have this:
title = re.search('<title>.*</title>', html, re.IGNORECASE).group()
if title:
title = title.replace('<title>', '').replace('</title>', '')
Is there a regular expression that will extract just the contents of so I don't have to remov...
Hi I have a problem in python. I try to explain my problem with an example.
I have this string:
>>> string = 'ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÀÁÂÃ'
>>> print string
ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿÀÁÂÃ
and i want, for example, replace charachters different from Ñ,Ã,ï with ""
i have tried:
>>> rePat =...
I have something like-
[[59],
[73 41],
[52 40 09],
[26 53 06 34],
[10 51 87 86 81],
[61 95 66 57 25 68]]
I need to add a comma before every space to be like -
[[59],
[73, 41],
[52, 40, 09],
[26, 53, 06, 34],
[10, 51, 87, 86, 81],
[61, 95, 66, 57, 25, 68]]
What would be regex string for that?
...
Hello,
I have a PO file with a content like:
msgid "or"
msgstr "or-translation"
msgid "orand"
msgstr "orand-translation"
I need to obtain the translation of a given msgid. Using the command "msggrep -K -e 'orand' template2.pot" I get the translation for 'orand', and this is ok.
But when I use "msggrep -K -e 'or' template2.pot" if...
Hi,
I'm trying to match a string like this:
{{name|arg1|arg2|...|argX}}
with a regular expression
I'm using preg_match with
/{{(\w+)\|(\w+)(?:\|(.+))*}}/
but I get something like this, whenever I use more than two args
Array
(
[0] => {{name|arg1|arg2|arg3|arg4}}
[1] => name
[2] => arg1
[3] => arg2|arg3|arg4
)
The ...
I am currently trying to use Jquery to change the href attribute of a link within a DIV so that the URL is changed from file.html to file.jpg...
<div class="gallery">
<a href="file.html">My File</a>
and I want to change it to
<div class="gallery">
<a href="file.jpg">My File</a>
I have seen the post about changing the href attribute...
Hello Peeps,
I have the following string:
$str = '#hello how are #you and #you and #you';
I would like to wrap some html around those which have the hash tag in front of them, for exampe:
echo preg_replace("/#([A-Za-z0-9_]+)(?= )/", "<a href='http://url.com/$1'>$0</a>", $str);
Which will output:
#hello how are #you and #...