ADAE Posted October 1, 2012 at 06:33 PM Report #477342 Posted October 1, 2012 at 06:33 PM Olá mais uma vez. Estou com um problema. Por necessidade ando a investigar a função Regex, mas não estou a conseguir filtrar isto: <meta name="description" content="Amazon.com: Louden Up Now: !!!: Music" /> Objetivo: Filtrar em 1 textbox apenas o texto: "Louden Up Now: !!!". Objetivo 2 (ainda não tentei fazer, pois não consigo o 1) Em 1 textbox colocar o valor: "Louden Up Now" e em outra "!!!" Cumpz.
jpaulino Posted October 3, 2012 at 07:59 AM Report #477525 Posted October 3, 2012 at 07:59 AM Podes tentar assim: var str = "<meta name=\"description\" content=\"Amazon.com: Louden Up Now: !!!: Music\" />"; var result = System.Text.RegularExpressions.Regex.Match(str, @"\[^:]*)\:"); if (result.Groups.Count != 0 ) { MessageBox.Show(result.Groups[1].Value); // Resultado: Louden Up Now }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now