Regular expression does not detect first entity

Asked

Viewed 31 times

0

That expression: (?<=.*"")\s is not detecting the first space it should detect:

<object name="Arrow" id="40" price="$400" description="Uma flecha comum.">

the correct would be to detect the following:

 <object name="Arrow" id="40" price="$400" description="Uma flecha comum.">
        ^            ^       ^            ^

but you’re detecting this:

 <object name="Arrow" id="40" price="$400" description="Uma flecha comum.">
                     ^       ^            ^

does not detect what is between "Object name".... Where is the error?

1 answer

2

This is happening I split the quotation marks after the .*

(?<=.*)\s

However you will still have to work on this regex as it will capture the spaces within the description attribute, which you also do not want.

  • So how do I put it so as not to capture what is within a value?

  • What exactly do you need? Do you want all attributes and values within a tag? I need to know what your intention is to try to help you in the best way.

  • I need to take the space that divides one attribute from the other, to do the Regex.Split() afterward...

  • after... what is it? Each value returned is within a Matcher Group that is an array of occurrences that REGEX has found, that is, you already have an array of each attribute.. What is the need for Regex.Split()?

  • I want to take what’s in the attribute, name and value, and for that I’m using Regex.Split to return a list with the text of the attributes, example: "teste_testando="valor do att""

Browser other questions tagged

You are not signed in. Login or sign up in order to post.