문제

I want to collect all data before a specified text or that ends with it, I have tried the following:

   .{30}Value_*|.{55}Value2_*

But you have to specify how many characters you want to collect before the specified ending text, I want to just collect all of them (Note that Im dealing with Python/Perl regexes here)

도움이 되었습니까?

해결책

Try something like:

"(.+?)Value_*|(.+?)Value2_*"

Without knowing exactly what your data looks like I can't get more specific. To break it down: .+ matches one or more characters, while ? makes it non-greedy, so it doesn't consume the entire line at once, and finally the parentheses capture the match (in Python at least).

다른 팁

Am I missing something? I'm not clear what the point of the trailing _* (zero or more underscores) is, but won't

^(.*)Value

do what you need?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top