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