Suppose there is a list that is input from the console using <STDIN>
@string = <STDIN>;
Now, I check for a pattern, say /manu/, in my program
foreach (@string)
{
if(/manu/)
{
print $_."\n";
}
}
The code is unable to look for the pattern /manu/.
However when I do the following, the code works perfectly fine:
...
I have to parse out color information from HTML data. The colors can either be RGB colors or file names to a swatch image.
I used http://www.gskinner.com/RegExr/ to develop and test the patterns. I copied the AS regular expression code verbatim from the tool into Flex Builder. But, when I exec the pattern against the string I get a n...
Am using vim and have a large text file that contains some html thrown in throoghout. Am trying to prepare it for the web and need to add <p></p> tags to the lines that are not yet formatted. Here is an example of what I have:
Paragraph text one one line [... more ... ]
Other paragraph text on the next line [... more ... ]
<h1>html ...
Does this vim regex match only correct JSON strings?
Does it match every correct JSON string?
Quotes are part of regex.
"\([^\\"]\|\\\(u\x\{4}\|["trf\\bn/]\)\)*"
UPD: I need JSON string objects ("...").
...
Im using PHP preg_match() method. I am having trouble with a regular expression to match a mm length. The numeerical length can be a float...here are some exmaples of the data I am working on;
1.0mm
25.5mm
3mm
3 mm
3.3 mm
So bacially any integer or float proceeded by "mm" with or without whitespace between.
Thanks!
...
Hi, I'm trying to get text from in between 2 html tags, only the difficulty is that the tag can differ from name.
I'll explain into detail:
<icon displayid="62115">inv_helmet_130</icon>
I have to get the
inv_helmet_130
But the displayid of the tag can differ, any ideas on how to solve this? Perhaps with a regular explression b...
Hi all, Having a hard time with this one as I don't think I know all of my options.
I have to parse a free form text field that I need to map the values to a database.
Here is some example text, NOTE: not all fields have to be there, not all delimiters are the same and not all descriptors are available. I do need to check if the value ...
I am getting completely different reults from string.scan and several regex testers...
I am just trying to grab the domain from the string, it is the last word.
The regex in question:
/([a-zA-Z0-9\-]*\.)*\w{1,4}$/
The string (1 single line, verified in Ruby's runtime btw)
str = 'Show more results from software.informer.com'
Work ...
Hello. I've got some text where some words are "real" words, and others are masks that will be replaced with some text and that are surrounded with, say, "%". Here's the example:
Hello dear %Name%! You're %Age% y.o.
What regular expression should I use to get "real" words, without using lookbehind, because they don't exist in JavaScrip...
<script type="text/javascript">
var str="Jestem bardzo, bardzo zadowolony. Można powiedzieć, że jestem również uszczęśliwiony i uspokojony.";
patt1=new RegExp( "\bi\b", "g"); //<--- (to find the single word: "i")
document.write(str.match(patt1));
</script>
It works well as var pattern = /\bi\b/g; but not when using RegExp("\bi\b","g...
Hi there,
I am currently iterating over somewhere between 7000 and 10000 text definitions varying in size between 0 and 5000 characters and I want to check whether a particular string exists in any of them. I want to do this for somewhere in the region of 5000 different string definitions.
In most cases I just want to to know an exact ...
Currently I have the following rules...
RewriteRule ^([^/]+)/([^/]*)(.htm)?$ index.php?filter=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/$ index.php?filter=$1 [L,QSA]
Which basically catch anything in /dirname/page.htm
Now there exists the chance that the script will have to intercept a variable level of paths, such as /dirname/twodirna...
Is is possible to create/use a regular expression pattern in ruby that is based on the value of a variable name?
For instance, we all know we can do the following with Ruby strings:
str = "my string"
str2 = "This is #{str}" # => "This is my string"
I'd like to do the same thing with regular expressions:
var = "Value"
str = "a test V...
Why next code returns true (Saxon-EE 9.2 for .NET)?
matches('some text>', '^[\w ]{3,200}$')
There is no > symbol in the pattern.
Thanks.
XQuery:
<regexp-test>
<!-- why true? -->
<test1>{matches('some text>', '^[\w ]{3,200}$')}</test1>
<test2>{matches('some text>', '^[\w ]+$')}</test2>
<test3>{matches('< < >', '^[\...
I have two quick question with regex with grep.
what does \? mean? I didn't find the explanation for question mark (?)
How can I achieve or? for example, the phone number xxx-xxx-xxxx but the first part could be (xxx)
For example, there might be a digit or not between two letters, such as a1b and ab, how to do that?
Thanks!
...
For http://macintosh.local/clientname/102
I can get the numeric reference (3 digits) like this:
RewriteRule ^[^/]+/([0-9]{3}+)/?$ album.php?ref=$1 [L]
Now I want to get my reference in my SEO URL:
http://macintosh.local/clientname/102-some-keywords
...
I am learning regex. I have a very simple question:
I have a long string of content in php.I would like to convert all places where it says:
http://www.example.com/en/rest-of-url
to
http://en.example.com/rest-of-url
Could somebody help me with this? I think I use preg_replace for this?
Bonus: If you have a link to a good site whi...
I don't know if this is even possible, I have the following regular expression (?<=[\?|\&])(?[^\?=\&#]+)=?(?[^\?=\&#]*)& which splits a URL into key/value pairs. I would like to use this in a replace function to build some markup:
string sTest = "test.aspx?width=100&height=200&";
ltTest.Text = Regex.Replace(sTest, @"(?<=[\?...
Hi,
I would like to get the phone numbers from a file. I know the numbers have different forms, I can handle for a single one, but don't know how to get a uniform regex. For example
xxx-xxx-xxxx
(xxx)xxx-xxxx
xxx xxx xxxx
xxxxxxxxxx
I can only handle 1, 2, and 4 together
grep '[0-9]\{3\}[ -]\?[0-9]\{3\}[ -]\?[0-9]\{4\}' file
Is t...
I need help with a regular expression for use with UrlRewriting.Net. I have two URLs -
http://domain/SomeFolder/tracks/SomeFileName/
and
http://domain/SomeFolder/<could be anything>/SomeFileName/
For URL rewriting purposes I need to come up with one expression that will let me target specifically the URL with "tracks" in the mid...