$source |% {
switch -regex ($_){
**'\<'+$primaryKey+'\>(.+)\</'+$primaryKey+'\>**' {
$primaryKeyValue = $matches[1]; continue; }
}
I want to use dynamic key value with switch-regex, is that possible?
I've got multiple SVN repositories of different projects which I would like to search for the same search term / regex, but without checking out or updating each project and doing the search manually on each of them.
I'd like to know if it is possible to search the file contents in multiple SVN repositories for some search term (or regex).
Well basically I've got a vb.net script connecting to IRC, and I'm working on making it a basic chat system, but I've run into a problem.
Say I receive this:
:[email protected] PRIVMSG #channel :message
I want to grab specific information to output to the user.
I want to grab nickname and message
How can I go about doing this?
I thought about using regex, but I can't figure out how to make regex grab message since there's nothing after it.
Hi All,
I am looking after fixing a bug and there I find this expression:-
directoryPath = Regex.Replace(directoryPath, "[^\\w\\.@-]", "");
but as a result of the expression all the high ascii characters in directory path are messed up, I am not good at regex and dont know about it but for now I have to fix the issue .
Can someone please explain me what this regular expression does?
I know you can generate all permutations from a list, using glob or Algorithm::Permute for example - but how do you generate all possible permutations from a regular expression?
I want to do like:
@perms = permute( "/\s[A-Z][0-9][0-9]/" );
sub permute( $regex ) {
# code - put all permutations of above regex in a list
return @list;
}
As I'm RegEx dyslexic.. what RegEx can you use to find each of the following strings - with the exception of "LoginException"?
NullPointerException
LoginException
BooException
Abc123Exception
Is there a differnet between ^[a-zA-Z] or [^a-zA-Z]?
When I check in C#,
Regex.IsMatch("t", "^[a-zA-Z]") // Return true (I think it's correct)
Regex.IsMatch("t", "[^a-zA-Z]") // Return false
There are alot of web site using [^a-zA-Z] for alphabet. I'm not really sure which one is correct answer.
Could someone please shed the light?
Hi everybody!
I have to set some routing rules in my php application, and they should be in the form
/%var/something/else/%another_var
In other words i beed a regex that returns me every URI piece marked by the % character, String marked by % represent var names so they can be almost every string.
another example:
from /%lang/module/controller/action/%var_1
i want the regex to extract lang and var_1
i tried something like
/.*%(.*)[\/$]/
but it doesn't work.....
Hey there.
I am very unfamiliar with nginx, as a forewarning, and also can't find any actual references on the regex system they use. So right now it's a black box to me.
All I want to do is redirect a user trying to go to www.mydomain.com/mydirectory/X to www.myotherdomain.com/X .
Seems like I should be using the rewrite command but the syntax of the regex is eluding me.
Thanks in advance.
I already know the basics of RegEx but I'm not sure where to go from here, I'm looking for both a good and above all easy to understand guide but I am also looking for things to use RegEx's for, it's all well and good reading about it but if you never use them then they will not stick in your mind.
I have already found regular-expressions.info but I'm sure there are more.
I'm writing a script to add extra smileys to the Gmail chat.
Its working partially, i'm stuck with the innerHTML.replace method @line 33
If you see, the regex in the replace method is passed using a variable. This is where the script is choking.
If i replace the variable with the actual regex, it works fine :|
I know you can generate all permutations from a list, using glob or Algorithm::Permute for example - but how do you generate all possible permutations from a regular expression?
i want to do like:
@perms = permute( "/\s[A-Z][0-9][0-9]/" );
sub permute( $regex ) {
# code - put all permutations of above regex in a list
return @list;
}
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!
Any code I've seen that uses Regexes tends to use them as a black box:
Put in string
Magic Regex
Get out string
This doesn't seem a particularly good idea to use in production code, as even a small change can often result in a completely different regex.
Apart from cases where the standard is permanent and unchanging, are regexes the way to do things, or is it better to try different methods?
Hi there,
i have a VB.NET program that handles the content of documents.
The programm handles high volumes of documents as "batch"(2Million documents;total 1TB volume)
Some of this documents may contain control chars or chars like f0e8(http://www.fileformat.info/info/unicode/char/f0e8/browsertest.htm).
Is there a easy and especially fast way to remove that chars?(except space,newline,tab,...)
If the answer is regex: Has anyone a complete regex for me?
Thanks!
In one of the StackOverflow Podcasts (the one where guys were discussing data generation for testing DBs -- either #11 or #12), Jeff mentioned something like "reverse regular expressions", which are used exactly for that purpose: given a regex, produce a string which will eventually match said regex.
What is the correct term for this whole concept? Is this a well-known concept?
hi all I have a regex defined in python/ruby/php that is like this
"(forumdisplay.php\?.*page=%CURRENTPAGE%)"
when I do it for java, I have to double escape that question mark to //?
like so:
"(forumdisplay.php\\?.*page=%CURRENTPAGE%)";
is there a function I can use to do that automatically? or would I need to change all my regexes over to work with the java regex engine?
thanks
I'm using regex to match all non-quoted property names in my json files. Eclipse has no problem finding the desired matches, but when I want to replace the matched strings with "$2", I get this error: Match string has changed in file filename.json. Match skipped
Here's the regex I'm using:
`((\w+)\s*(?!['"])(?=:))`
Any idea on how to work around this issue?
Hello,
I would like to find all comment blocks(/*...*/) but the function g_regex_match_full always returns true.
Here is the code :
// Create the regex.
start_block_comment_regex = g_regex_new("/\*.*\*/", G_REGEX_OPTIMIZE, 0, ®ex_error);
//Search the regex;
if(TRUE == g_regex_match_full(start_block_comment_regex, current_line, -1, 0, 0, &match_info, ®ex_error))
{
}
Is there any native library in STL which is tested and works without any extra compiler options?
I tried to use <regex>, but the compiler outputs this:
In file included from /usr/include/c++/4.3/regex:40, from main.cpp:5:
/usr/include/c++/4.3/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
What is the best way to achieve sscanf-like functionality in perl?
I am looking now looking at the sscanf module,
Which is better,
Option-1: Going sscanf way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
What is the best way to achieve sscanf like functionality in perl?
I am looking now looking at the sscanf module,
Which is better,
Option-1: Going sscanf way?
Option-2: Regex way? [I am a beginner when it comes to Regex]
Consider it that '_'s in a number doesn't change that number's value so 1000==1_000==10_00.
The Problem: given numbers like 1_244_23 1412_2 1_1111 etc..., how could I decide whether certain number appears in that collection? For example: 1244_23 yes, 11_111 yes, 1412_1 no.
How could using regex to solve this? I mean, if I could tell the regex engine just ignore these '_''s when matching then this problem becomes trivial? How could I do so?
I have a small JavaScript validation script that validates inputs based on Regex. I want to allow certain characters that are not exactly common (not sure if they're UTF8). For example I want to allow the following character ’, which looks like a single quote, but isn't.
I got the HTML code for this which is ’, but I'm not sure how to put this into the Regex.
I've tried just inputting [’]* but it doesn't validate.
Hi,
From HTML body,I have to extract link which has text "Customer".For example
<a href="google.com">Customer </a>
I was thinking of using regex. What regex to use?