You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

EditPadPro正则匹配需求:仅匹配POLYLINE、TYPE=0x6、RoadID

Fixing Your EditPad Pro Regex for POLYLINE + Type=0x6 + RoadID Matches

Got it, let's get that regex working properly for you! Your current pattern only catches the first two parts of what you need—we'll expand it to ensure it matches only the blocks that include all three: [POLYLINE], Type=0x6, and RoadID.

Solution 1: Fixed Order (Matches Your Example)

If the elements always appear in the order [POLYLINE] → Type=0x6 → RoadID (like your sample text), use this regex:

\[POLYLINE\].*?Type=0x6.*?RoadID.*?\[END\]

Breakdown:

  • \[POLYLINE\]: Explicitly matches the opening tag (brackets are escaped because they’re special regex characters)
  • .*?: Non-greedy match for any characters—stops at the next target instead of grabbing everything in the document
  • Type=0x6: Matches the exact type value you need
  • RoadID: Ensures the block includes this identifier
  • .*?\[END\]: Finishes matching until the closing [END] tag

Solution 2: Flexible Order (Elements Can Be Anywhere)

If Type=0x6 and RoadID might appear in any order within the [POLYLINE] block, use positive lookaheads to enforce all three conditions are met:

\[POLYLINE\](?=.*?Type=0x6)(?=.*?RoadID).*?\[END\]

Breakdown:

  • (?=.*?Type=0x6): Positive lookahead—checks that Type=0x6 exists somewhere after [POLYLINE] without consuming characters
  • (?=.*?RoadID): Another lookahead to confirm RoadID is present in the block
  • The rest works the same as Solution 1, capturing the full block from start to end

Handling Multi-Line Blocks

If your [POLYLINE] blocks span multiple lines, replace .*? with [\s\S]*? (this matches any whitespace or non-whitespace character, including newlines):

\[POLYLINE\](?=[\s\S]*?Type=0x6)(?=[\s\S]*?RoadID)[\s\S]*?\[END\]

Alternatively, you can enable the "Dot matches newlines" option in EditPad Pro's regex settings—this makes .*? include line breaks too.

Why Your Original Regex Didn't Work

Your pattern \[POLYLINE]\W+(?:\w+\W+0x6) only matches up to the 0x6 part and doesn’t check for RoadID at all. It also stops short of capturing the full block, which is why you weren't getting the complete matches you need.

How to Use This in EditPad Pro:

  1. Open the Find dialog (Ctrl+F)
  2. Switch to the Regular expression mode
  3. Select your preferred regex flavor (Perl, Java, or .NET—all support these patterns)
  4. Paste the regex from above and hit "Find Next"

内容的提问来源于stack exchange,提问作者JohnWeck

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 00:27:38