Could you help me sort some regex.
I want all the whitespace before the <pre>
public Regex BeforePre = new Regex(@"^.*?(?=<pre>)", RegexOptions.Compiled);
That will select everything before the <pre>
, not just the whitespace. I want to only select the whitespace.
using http://regexstorm.net/tester
Pattern: ^.*?(?=<pre>)
Input: dewjdoiejw; test <pre>frfef</pre>
I believe it's \\s
but I can not get it to work.
Also I would like it so it works across multiple lines, for example:
Input: dewjdoiejw; test
<pre>frfef</pre>
Please let me know if you need more info.
UPDATE
see.... http://goo.gl/8mX5c3
I want to remove all white space and tabs before <pre>
I only want to consider all text before <pre>
and from that text remove all white-space/tabs.
UPDATE
from
<div>
<div>
some text
<div>some text</div>
</div>
<div>some text</div>
</div>
<pre>
<div>
<div>some text
<div>some text</div>
</div>
<div>some text</div>
</div>
</pre>
to
<div><div>some text<div>some text</div></div><div>some text</div></div>
<pre>
<div>
<div>some text
<div>some text</div>
</div>
<div>some text</div>
</div>
</pre>
Okay: It's possible using only one regex:
Very short - I know :-)
Sorry - but don't ask me for explanation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.