Hello there,
This may be a very trivial problem I'm trying to solve, but I'm sure there's a better way of doing it. So please go easy on me.
I have a bunch of XSD files that are internal to our application, we have about 20-30 Xml files that implement datasets based off those XSDs. Some Xml files are small (<100Kb), others are about 3-...
Is there a way to find custom tags in regexp I.e. match
{a}sometext{/a}
As well as
{c=#fff}sometext{/c}
So that it finds the entire block of inner content? The problem is the sometext could have another tag as in:
{a=http://www.google.com}{b}Hello, world{/b}{/a}
The only solutions I can come up with would match from ...
I need help on regular expression on the condition (4) below:
Begin with a-z
End with a-z0-9
allow 3 special characters like ._-
The characters in (3) must be followed by alphanumeric characters, and it cannot be followed by any characters in (3) themselves.
Not sure how to do this. Any help is appreciated, with the sample and some e...
I'm working with regular expressions (Regex) but not finding the exact output.
I want to find the values between two curly braces
{ Value } = value
I use the following pattern but not getting the exact output; it does not remove first "{" ...
string pattern = "\\{*\\}";
If my value is {girish}
it returns {girish
Instead of this ...
I have several posts on a website; all these posts are chat conversations of this type:
AD: Hey!
BC: What's up?
AD: Nothing
BC: Okay
They're marked up as simple paragraphs surrounded by <p> tags.
Using the javascript replace function, I want all instances of "AD" in the beginning of a conversation (ie, all instances of "AD" at the s...
My code is:
#include <boost/regex.hpp>
boost::cmatch matches;
boost::regex_match("alpha beta", matches, boost::regex("([a-z])+"));
cout << "found: " << matches.size() << endl;
And it shows found: 2 which means that only ONE occurrence is found… How to instruct it to find THREE occurrences? Thanks!
...
My goal is to find the package (as string) of a Java source file, given as plaintext and not already sorted in folders.
I can't just locate the first instance of the keyword package in the file, because it may appear inside a comment. So I was thinking about two alternatives:
Scan the file word-by-word, maintaining an "inside-a-commen...
hi guys,
i want to append my own value to all hyperlinks in a page... e.g if there are links:
<a href="abc.htm?val=1">abc 1</a> <br/>
<a href="abc.htm?val=2">abc 1</a> <br/>
<a href="abc.htm?val=3">abc 1</a> <br/>
<a href="abc.htm?val=4">abc 1</a> <br/>
I want to add next var like "type=int" to all hyperlinks
output should be:
<a ...
Hi,
i need to check a string that should contain only ABCDEFG characters, in any sequence and with only 7 characters. Please let me know the correct way of using regular expression.
as corrently i am using
String abs = "ABPID";
if(!Pattern.matches("[[ABCDEFG]", abs))
System.out.println("Error");
i am using the following code which ...
Hi,
i am wrestling with my regex.
I want to allow only letters and numbers and a dot in a username, and 2 to 20 chars long
I thought of something like this
[0-9a-zA-Z]{2,20}
but then 21 chars is also ok, and that's not what i want
...
Hi,
Is there anyway to skip the first match when using regex and php.
Or is there some way of achieveing this using str_replace.
Thanks
UPDATE
I am trying to remove all the instances of a string from another string but I want to retain the first occurance e.g
$toRemove = 'test';
$string = 'This is a test string to test to removing t...
Hi all
I have the following string "3/4Ton". I want to split it as -->
word[1] = 3/4 and word[2] = Ton.
Right now my piece of code looks like this:-
Pattern p = Pattern.compile("[A-Z]{1}[a-z]+");
Matcher m = p.matcher(line);
while(m.find()){
System.out.println("The word --> "+m.group());
}
It carries out the needed task of ...
I've tried to understand a few examples, including questions here so I apologise if this seems to me a duplicate but I cannot find a RegularExpression I can understand.
I have some HTML to parse using an XML parser - but I want to strip out the <head> </head> tags from this content as the rest is valid enough for normal XML Parsing.
The ...
Hello ,
What I need to implement is to
find patterns in a string , store matches replace the matches with unique tokens so that later on the token could be replaced by its match found earlier.
To explain
for eample I have an array of patterns
paterns = [/Mr\.\s/,/Mrs\.\s/];
stringSubject = "Mr. john is an expert. mrs. john is no...
Just using SQL Server 2000 built in features ONLY, what is the best way to handle special characters. I am not sure if Regular Expression could be used by purely using built in features? I would like to search and replace the special characters in my queries.
Thanks
...
Possible Duplicate:
Javascript regex returning true.. then false.. then true.. etc
var r = /\d/g;
var a = r.test("1"); // will be true
var b = r.test("1"); // will be false
console.log(a == b); // will be false
Please explain to me why the result of r.test("1") alternates with each call?
I was able to work around the issue ...
HI guys.
Im using mod_rewrite to do some redirects on a web site.
I want to be able to do the following
mySite.com/ -> Goto Home
mySite.com/foo -> Goto redirect.php and redirect acordingly.
My redirect rule was
RewriteRule (^\w*$) redirect.php?url=$1 [NC]
But im oviously missing something because when I go tomySite.com/ I get sent t...
I'm trying to identify and condense single (uppercase) characters in a string.
For example:
"test A B test" -> "test AB test"
"test A B C test" -> "test ABC test"
"test A B test C D E test" -> "test AB test CDE test"
I have it working for single occurrences (as in the first above example), but cannot figure out how to chain it for m...
<th>Prêmio</th>
<td colspan="11">
<div class="res"><img class="r1" src="img/x.gif" alt="Madeira" title="Madeira" />215 | <img class="r2" src="img/x.gif" alt="Barro" title="Barro" />193 | <img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />192 | <img class="r4" src="img/x.gif" alt="Cereal" title="Cereal" />202</div><div cl...
I have the following regex: (?<=\.\d+?)0+(?=\D|$) I'm running it against a string which contains the following: SVC~NU^0270~313.3~329.18~~10~~6.00:
When it runs, it matches the 6.00 (correctly) which my logic then trims by one zero to turn into 6.0. The regex then runs again (or should) but fails to pick up the 6.0.
I'm by no means an...