Regular expression
-
Hi, This is my string "Product : tempuri" i want to search "Product :" and want to save the value of the next word in a group. please tell me the regex.
-
Hi, This is my string "Product : tempuri" i want to search "Product :" and want to save the value of the next word in a group. please tell me the regex.
Try here http://tinyurl.com/n2cn5m[^]
-
Hi, This is my string "Product : tempuri" i want to search "Product :" and want to save the value of the next word in a group. please tell me the regex.
karmjit435 wrote:
i want to search "Product :" and want to save the value of the next word in a group.
You can do this without using regex. A possible solution could be (just an example):
string str = "Product : tempuri";
// Get the product "value"
string strProduct = str.Substring(str.IndexOf(":") + 1);Regards Nuri Ismail
-
Hi, This is my string "Product : tempuri" i want to search "Product :" and want to save the value of the next word in a group. please tell me the regex.
karmjit435 wrote:
please tell me the regex.
What have you tried already? HAve you looked at any documentation for regex? Do you just want some hardworking person here to provide you the answer? Do they therefore get your paycheck for this piece of work? Many questions, not many answers.
-
karmjit435 wrote:
please tell me the regex.
What have you tried already? HAve you looked at any documentation for regex? Do you just want some hardworking person here to provide you the answer? Do they therefore get your paycheck for this piece of work? Many questions, not many answers.
ok.. your point is right.. i was expecting this kind of reply.. i have string String s = "this is Product : temp org is fine"; can you tell me how can can get "temp" only in my value group. here is what i tried Regex productRegex = new Regex(@"(Product) *(:b)*:(:b)*(?<value> .+) ");
-
Hi, This is my string "Product : tempuri" i want to search "Product :" and want to save the value of the next word in a group. please tell me the regex.
i have string String s = "this is Product : temp org is fine"; can you tell me how can can get "temp" only in my value group. here is what i tried Regex productRegex = new Regex(@"(Product) *(:b)*:(:b)*(? .+) "); can you tell me.. there can some error while posting the message after ? there is group.
-
ok.. your point is right.. i was expecting this kind of reply.. i have string String s = "this is Product : temp org is fine"; can you tell me how can can get "temp" only in my value group. here is what i tried Regex productRegex = new Regex(@"(Product) *(:b)*:(:b)*(?<value> .+) ");
-
Whats wrong with simply:
Product : (?<value>[a-zA-Z]+)
Assuming only alpha characters after the : that should work just finemodified on Thursday, September 10, 2009 10:33 AM
You don't need that question mark; I'd use
Product\s*:\s*(\w+)
-
You don't need that question mark; I'd use
Product\s*:\s*(\w+)
-
the ? was the start of a named group <value> - I just forgot to escape the angle brackets :rolleyes:
Ah, I use apostrophes for that instead:
(?'value'\w+)
At least it helps in these cases. -
i have string String s = "this is Product : temp org is fine"; can you tell me how can can get "temp" only in my value group. here is what i tried Regex productRegex = new Regex(@"(Product) *(:b)*:(:b)*(? .+) "); can you tell me.. there can some error while posting the message after ? there is group.
-
You don't need that question mark; I'd use
Product\s*:\s*(\w+)
Hi, Thanks that resolved my problem. Regards, KS
-
You don't need that question mark; I'd use
Product\s*:\s*(\w+)
there is another problem i have string Product : temp product name \ i have to extract the string after : and before \ KS