Announcement

Collapse
No announcement yet.

Best may to ignore parts of a line, regex and GUI question

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Best may to ignore parts of a line, regex and GUI question

    Hello,

    I am not sure the best way to accomplish the following, via Rules or Format?. I am also new to anything beyond the basic features of bc. I want the following and be able to recall the settings in a later session.

    '^#|^# '[:alpha:] <-- so a '#' followed by a character or a '#' followed by a SPACE or TAB and then a character at the begging of a line should be ignored. NOT the line but the characters. Everything until the EOL or another '#' are to be compared.

    Example:

    '# ABC 12345# anything else' only the underlined text should be compared, 'ABC 12345'.

    Any hints or recommendations?

    Thanks in advance

  • #2
    Hello,

    BC4's Formats are used to define Grammar Elements, and those Element can then be marked as Important or Unimportant in the Rules (Session Settings). If you give the custom element the same name, you can simplify the definitions and remove Or conditions, such as having a String element that is
    " to "
    and another String element that is
    ' to '
    Then the String element on a whole can be marked as Important or Unimportant, and it applies to both element definitions, without needing a single definition of "or' to matching but not the other, etc.

    A grammar element can be defined with a regular expression, but we don't support lookaheads or backreferences, so two layer logic isn't quite the approach. Instead you'll need to define either the Underlined text explicitly and make that section Important and everything else Unimportant, or define the Unimportant section and mark it as Unimportant. From the example, the later might be easier. What if you defined # to end of line, excluding any # within the section? Something like:
    #[^#]+$

    This would potentially match on a line that had only one #, but does that scenario occur, or would this always match on the last # to the End of Line?

    Update: Reference Link https://www.scootersoftware.com/supp..._unimportantv3
    I should add the KB article with a helpful video on how/where to define elements and mark them as Unimportant.
    Last edited by Aaron; 04-May-2023, 12:45 PM. Reason: Update: adding link to our KB on the subject
    Aaron P Scooter Software

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎