I'm using the Jison parser generator for Javascript and am having problems with my language specification.
The program I'm writing will be a calculator that can handle feet, inches and sixteenths.
In order to do this, I have the following specification:
%%
([0-9]+\s*"'")?\s*([0-9]+\s*"\"")?\s*([0-9]+\s*"s")? {return 'FIS';}
[0-9]+("."...
Hi there,
I need to apply validation on input time intervals that are taken in as seconds. Now i am not really good at Regular expressions. So can any body help making a regular expression that can test whether a number is divisible by 60.
I was wondering if i could use to test one that check that the number is divisible by 10 and then...
Both in Actionscript3 and Javascript these statements give the same result:
/\S/.test(null) => true
/null/.test(null) => true
/m/.test(null) => false
/n/.test(null) => true
Seems that null value is converted into string "null" in this case.
Is this a known bug in Ecmascript or am I missing something?
...
file.txt contains:
##w##
##wew##
using mac 10.6, bash shell, the command:
cat file.txt | grep [[:alpha:]]* -o
outputs nothing. I'm trying to extract the text inside the hash signs. What am i doing wrong?
...
How would I extract the dollar amount from the following string
"some text will go here and more and more and then there will be some price $34.03 but that doesn't mean the string will end"
I want to extract $34.03...also want to extract if there is no cents
"some text will go here and more and more and then there will be some price $...
Given an HTML string like:
<span class="findme" id="31313131313">The Goods</span>
What kind of REGEX in Coldfusion would return just (if it's even possible?): 31313131313
Thanks!
...
Hi all,
I'm a regexp novice, so I'm wondering what the regexp for the following:
function {function arg1, arg2}, arg3
I'm looking to be able to just select the top-level arguments: {function arg1, arg2} & arg3
Ideally the response would be using preg_match in PHP, but almost any regexp would work fine.
Thanks!
Matt
...
Does anyone know a regex function in PHP to strip an anchor of its contents, only if the anchor's href attribute contains specific text?
For example, I have an HTML page and there are links throughout. But I want to strip only the anchors that contain "yahoo" in the URL. So <a href="http://pages.yahoo.com/page1">Example page</a> woul...
Could someone lead me on finding a regular expression that blocks a comma separated list of Spam words I already have?
The regular expression needs to match a string with the spam word list I already have.
Not that it matters, but I am using PHP.
...
I have some markup that contains certain HTML image tags with the class featured. What I need is to find all those images, add an anchor tag around the image, set the href attribute of the anchor to the images src value (the image path), and lastly replace the images src value with a new value (I call a method that will return this value...
Hi All
I am working with the new version of boost 1.42 and I want to use regex with named sub groups. Below an example.
std::string line("match this here FIELD=VALUE in the middle");
boost::regex rgx("FIELD=(?<VAL>\\w+)", boost::regex::perl );
boost::smatch thisMatch;
boost::regex_search( line, thisMatch, rgx );
Do you know how to g...
I need a regular expression in Javascript, as well as in PHP, for Indian vehicle NUMBER.
Here is the conditions list:
(x)(y)(z)(m)(a)(b)(c)
1. (x) contains only alphabets of length 2.
2. (y) may be - or single space ' '.
3. (z) contains only numbers of length 2.
4. (m) may be or , or single space ' '.
5. (a) must be one or two alph...
World's most convuluted title I know, an example should explain it better. I have a large txt file in the below format, though details and amount of lines will change everytime:
Username: john_joe Owner: John Joe
Account:
CLI:
Default:
LGICMD:
Flags:
Primary days:
Secondary days:
No access restrictions...
Hi,
I have the following php code in a utf-8 php file:
var_dump(setlocale(LC_CTYPE, 'de_DE.utf8', 'German_Germany.utf-8', 'de_DE', 'german'));
var_dump(mb_internal_encoding());
var_dump(mb_internal_encoding('utf-8'));
var_dump(mb_internal_encoding());
var_dump(mb_regex_encoding());
var_dump(mb_regex_encoding('utf-8'));
var_dump(mb_regex...
What is the c#.net equivalent for php's preg_replace function?
php code is like this:
const ALLOW_VALUES = '[^a-z0-9àáâäèéêëìíîïòóôöùûŵýÿyÁÂÄÈÉÊËÌÎÏÒÓÔÖÙÛÜŴYÝ]';
public function streetTownHash($data, $hashCheck = false, $updateRecord = false)
{
foreach($data as $key=>$value){
try{
$value = mb_conve...
How can I extract the groups from this regex from a file object (data.txt)?
import numpy as np
import re
import os
ifile = open("data.txt",'r')
# Regex pattern
pattern = re.compile(r"""
^Time:(\d{2}:\d{2}:\d{2}) # Time: 12:34:56 at beginning of line
\r{2} # Two carriage return
...
Is it possible to do a regex replace on all IMG tags that are unclosed? If so, how would I identify:
<img src="..." alt="...">
...as a potential canidate to be replaced?
= <img src="..." alt="..."/>
Update: We have hundreds of pages, and thousands of image tags, all must of which must be closed. I'm not stuck on RegEx -- an...
I think this is sufficiently different from similar questions to warrant a new one.
I have the following regex to match the beginning hyperlink tags in HTML, including the http(s):// part in order to avoid mailto: links
<a[^>]*?href=[""'](?<href>\\b(https?)://[^\[\]""]+?)[""'][^>]*?>
When I run this through Nregex (with escaping remo...
I couldn't find a more descriptive title, but here there is an example:
import re
m = re.search(r"\((?P<remixer>.+) (Remix)\)", "Title (Menda Remix)")
m.group("remixer") # returns 'Menda' OK
m = re.search(r"\((?P<remixer>.+) (Remix)\)", "Title (Blabla) (Menda Remix)")
m.group("remixer") # returns 'Blabla) (Menda' FAIL
This regex finds...
According the the Perl documentation on regexes:
By default, the "^" character is guaranteed to match only the beginning of the string ... Embedded newlines will not be matched by "^" ... You may, however, wish to treat a string as a multi-line buffer, such that the "^" will match after any newline within the string ... you can do th...