Regex in a Text File type

I'm trying to set up a Text File Type. In the file, lines starting with the character '!' are comment lines that must be excluded from the translation.

Example line that must not be translated:

! Note: Do Not Use "". Line will be cut.

The only option I seem to have is to define an Inline Tag that will set up " lines starting with the character '!' " as a placeholder.

I've tried various regexp, but none seem to work. The most basic one is:

^!.+\$

I've also tried !.+ and a few others, but my lines starting with ! keep showing up as translatable. This may have to do with ! being a special character. But escaping the ! has no effect either: ^\!.+\$

Top Replies

• So how do I get segmentation by line instead of by sentence?

As I said above, you can use paragraph segmentation.  This is probably the best approach given…

• In fact with one small change to your filetype rule because of the ! on its own:

^!.*\$

You'll get this:

So quite simple in the end.

Parents
• Here's a larger section of the file:

! Note: Do Not Use "". Line will be cut.

! Number 601-699 : SOFTWARE
! Number 701-799 : TOOL
! Number 801-899 : SPARE
! Number 901-999 : SPARE
! ***********************************************
!
TXTDATA
! ***********************************************
! Category      : GENERAL
! ***********************************************
!-- Error - [1] ---------------------------------

Actions
1.Check air pressure settings and pressure.
2.Check if reed switch is working correctly.
3.Check if cylinder is not blocked.
4.Check electric/pneumatic circuits.

Each line should be 1 segment. Each line that starts with a ! must not be translated.

I've done more tests. The trouble starts with the segmentation rules:

If I set segment start = ^ and segment end =\$, multiline off, each sentence becomes a segment:

!

Note:

Do Not Use "".

Line will be cut.

According to the regex references I have, '\$' should be the end of a paragraph, not the end of a sentence. Or according to another reference (https://regexr.com/), it's the end of a string.

If I set segment start = ^ and segment end =\n, multiline off, the preview shows 0 segments. If I enable Multiline, each line is split into sentences again.

So how do I get segmentation by line instead of by sentence?

• So how do I get segmentation by line instead of by sentence?

As I said above, you can use paragraph segmentation.  This is probably the best approach given you said this:

Each line should be 1 segment.

This explains how to do this... it's on the TM and not on the file:

multifarious.filkin.com/.../

• In fact with one small change to your filetype rule because of the ! on its own:

^!.*\$

You'll get this:

So quite simple in the end.