[Vala] Regex Question
- From: "Starr, Larry A" <LarryA Starr intel com>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: [Vala] Regex Question
- Date: Sun, 4 Oct 2009 22:37:40 -0600
Hello Everyone, I am new to Vala programming.
I'm having a problem compiling the following simple regular expression with Vala 0.7.5.
void println (string str) {
stdout.printf ("%s\n", str);
}
int main (string[] args) {
string s ;
try {
//var regex = new Regex ("(jaguar|tiger|leopard)");
var regex = new Regex ("/\*.*?\*/");
s = "wolf, tiger, eagle, jaguar, leopard, bear";
println (regex.replace (s, -1, 0, "kitty"));
} catch (RegexError e) {
warning ("%s", e.message);
}
return 0;
}
When I try to compile it, I get the following errors:
filc20059> valac regex.vala
regex.vala:9.36-9.36: error: invalid escape sequence
var regex = new Regex ("/\*.*?\*/");
^
regex.vala:9.41-9.41: error: invalid escape sequence
var regex = new Regex ("/\*.*?\*/");
^
Compilation failed: 2 error(s), 0 warning(s)
The regex is strait from the glib documentation at
http://library.gnome.org/devel/glib/stable/glib-regex-syntax.html
On the section about greediness.
Can anyone Please help me out and point out what I might be doing wrong?
Thanks in advance,
Larry
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]