Is there any difference in speed/memory usage for these two equivalent expressions:
Regex.IsMatch(Message, "1000")
Vs
Message.Contains("1000")
Any situations where one is better than other ?
Which features of regular expressions are standard, and which are idiosyncratic ?
What should I do, and not do, if I want to use the same regex in different context, languages, platforms ?
Hi,
I would like to know if C++ provides any API (not third-party) for pattern matching using regular expressions like Java does. If it doesn't, whats the best way to do it ?
Thanks.
Hi All
I don't usually use regular expressions, hence my question. I need a regex to match the following:
'{any-string}'.
Any assistance appreciated.
BenTheDesigner
Is there a way to display "Test" value as bold just like the implementation of newline?
<testElement>Test 
 Test</testElement>
The output of the above line when you display it is:
TEST
TEST
I want to know what/how to make the second line as bold just line by using expressions.
Thank you
I have a Flex repeater that has a complex item template. When a checkbox is clicked, I need to toggle the visibility of a sibling button contained in the same repeater template. Since I can't add binding expressions to event handlers, I can't pass in the repeater item's index.
How can I access sibling components inside a repeater item?
Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.
If letter case was unimportant I would do this:
str.toLowerCase().replaceAll ("a|the|of|some|any", "");
Is there an "ignore case" solution with regular expressions in java?
I am trying to move away from TextPad and I just cant get reg expressions like ^ and $ to be replaced.
I have definitely ticked the regular expression box
What am I doing wrong
I am using Python with PLY to parse LISP-like S-Expressions and when parsing a function call there can be zero or more arguments. How can I put this into the yacc code. This is my function so far:
def p_EXPR(p):
'''EXPR : NUMBER
| STRING
| LPAREN funcname [EXPR] RPAREN'''
if len(p) == 2:
p[0] = p[1]
else:
p[0] = ("Call", p[2], p[3:-1])
I need to replace "[EXPR]" with something that allows zero or more EXPR's. How can I do this?
Is it possible to do something like this in C#? Probably with Expressions.
private void RegisterEvent(EventHandler handler, Action<EventArgs> action)
{
handler += action;
m_toUnsubscribe.Add(handler, action);
}
... in Dispose()
{
foreach(var pair in m_toUnsubscribe)
{
pair.handler -= pair.action;
}
}
I have some experience with C#, and would like to improve my knowledge of its latest improvements. I am in the middle of reading and enjoying "Effective C#" by Bill Wagner right now. However, I would appreciate more examples, especially with lambda expressions and such.
Any suggestions are greatly appreciated. High quality resources are preferable, and it does not matter much if they are free or not.
Hello.
In ruby there's very common idiom to check if current file is "main" file:
if __FILE__ == $0
# do something here (usually run unit tests)
end
I'd like to do something similar in C after reading gcc documentation I've figured that it should work like this:
#if __FILE__ == __BASE_FILE__
// Do stuff
#endif
the only problem is after I try this:
$ gcc src/bitmap_index.c -std=c99 -lm && ./a.out
src/bitmap_index.c:173:1: error: token ""src/bitmap_index.c"" is not valid in preprocessor expressions
Am I using #if wrong?
I am looking for a simple tool that generates a catalog of all used action methods, values and bindings. I'm working on a big JSF/RichFaces project and I have lost the overview of the used links to the beans. Therefore I need a tool (would be nice if it is a Eclipse plugin) that generates a simple list of all used EL expressions.
Is there something out there?
i've a table c_const
code | nvalue
--------------
1 | 10000
2 | 20000
and i've another table t_anytable
rec_id | s_id | n_code
---------------------
2 | x | 1
now i want to calculate the x value with computed column, based on
rec_id*(select nvalue from c_const where code=ncode)
but i get error "Subqueries are not allowed in this context. Only scalar expressions are allowed."
how can i calculate the value in this computed column ?
thanks.
I am using Firefox's native JSON.parse() to parse some JSON strings that include regular expressions as values, for example:
var test = JSON.parse('{"regex":"/\\d+/"}');
The '\d' in the above throws an exception with JSON.parse(), but works fine when I use eval (which is what I'm trying to avoid).
What I want is to preserve the '\' in the regex - is there some other JSON-friendly way to escape it?
I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]".
It returns strings like:
int(11)
float
varchar(200)
int(11) unsigned
float(6,2)
I've tried to do the job using regular expressions but it's not working.
PHP CODE:
$string = "int(11) numeric";
$regex = '/(\w+)\s*(\w+)/';
var_dump( preg_split($regex, $string) );
Hi,
I got used to the xml support and recursive common table expressions of sql server 2005. I am just wondering whether any free dbs like mysql support these requirements nowadays? Thanks.
Christian
1) Why are member constants available even if there are no instances of a its class?
2) Is the only reason why constant expressions need to be fully evaluated at compile time due to compiler replacing constant variable with literal value?
3) Since string is also an object, I would think the following would produce an error, but it doesn’t. Why?
class A
{
const string b = “it works”;
}
thank you
Hi.
I want to retrieve all hashtags from a tweet using a PHP function.
I know someone asked a similar question here, but there is no hint how exactly to implement this in PHP. Since I'm not very familiar with regular expressions, don't know how to write a function that returns an array of all hashtags in a tweet.
So how do I do this, using the following regular expression:
#\S*\w
i want to delete the following type of expressions from my script.
<a any text here>nothing or space here</a>
i can do it by three functions, but i think there is a way shorter.
could you help me?
thanks in advance
Hi folks,
I have a little program allowing users to type-in some regular expressions. afterwards i like to check if this input is a valid regex or not.
I'm wondering if there is a build-in method in Java, but could not find such jet.
Can you give me some advice?
Best regards
Phil
I am new to regular expressions. I want to use java's replaceAll() function to replace any CSS comments in a string.
Basically I want to use regex to search for anything that is surrounded by "/*" and "*/" and replace it with "".