Import Utilities


The regular expression (abbreviated as regex or regexp) is a sequence of characters that form a search pattern, mainly for use in pattern-matching with strings or string-matching. Functionality is similar to find and replace operations with more complexity and specificity. See the wikipedia entry for a detailed description of Regexp and a table of used characters.

Regexps can be used in the Search and Replace fields in the Memsource Editor for the Convert to tags feature in File Import Settings and for customizing segmentation rules.


Memsource supports Java regexp, but will reject complex regular expressions to protect the system from overload. Complex regexps are those with quantifiers (except possessives) on groups which contain other quantifiers (except possessives).

General Examples

Examples for converting text into tags when importing files and also for using regexp in the Memsource Editor for Search and Replace functions:




represents <html_tag>


represents {variable},


represents [variable],


represents [[aa[11]bb]].


represents $operator_Name1$.


represents numbers. Also, [0-9]+


represents any alphanumeric character.


email address


the date 2018-08-01


a whitespace at the end of the segment


a whitespace at the beginning of the segment


a double whitespace


a digit at the beginning of the segment


a double whitespace between words


a newline preceded by any whitespace character


a newline preceded by any non-whitespace character


converts php variables and html code ($svariable['name'] =)


converts javascript's field key with added whitespaces at the beginning of the line ( 'key' :)

TXT Import

Examples of regular expressions when importing a specific text:

  1. ## ErrorMessage ##1## The number must be higher then 0. ##Z##

    To import text between ##1## and ##Z## use regexp: (?&lt;=##1## ).*(?= ##Z##)

  2. ErrorMessage ("The number must be higher then 0.")

    To import text between (" and ") use regexp: (?<=\(").*(?="\))

  3. 'errorMessage' = 'The number must be higher than 0.'

    To import text after the = sign and between ' and ' use regexp: (?<=\= ').*(?=')

  4. msgstr ("The number must be higher than 0.")

    To import msgstr strings in monolingual PO files using a TXT filter, use regexp: (?<=msgstr ").*(?=")

  5. # Note: This is a note

    To exclude lines starting with # use regexp: (^[^#].*)

  6. values '126', 'DCeT', 'Text (en)'

    To import only text in quotes and with (en), such as Text (en)' use regexp: (?<=')[^']*\(en\)(?=')

JSON Import

JSON structure example:

"list": {
	"id": "1",
	"value": "text 1 for translation."
"text": {
	"id": "2",
	"value": "text 2 for translation."
"menu": {
	"id": "3",
	"value": "text 3 for translation."
	 },"array": ["blue","green"],"arrays": [{        "color": "blue",        "title": "BLUE"
         },         {        "color": "green",        "title": "GREEN"         }    ]}
  • for importing every value regardless of the level, use: (^|.*/)value

  • for importing only one value from a list use: list/value

  • for importing a value from a list and/or menu use, the | (OR) operator: list/value|menu/value

  • for importing only the first instance of a value from a menu, use: menu\[1\]/value

  • for importing the content of a JSON array following a certain key, use: (^|.*/)array\[.*\]

  • to import the content of a specific array of objects, use: (^|.*/)arrays\[.*\].*

YAML Import

YAML flie example:

title: A
text: translate A
  title: B
  text: translate B
  title: C
  text: translate C
      title: D
      text: translate D

regexp for importing:

  • only 'translate A' : text

  • only 'translate C'categories\[2\]/text

  • only 'translate D'categories\[\d+\]/content[\1\]/text

  • all text: text|categories\[\d+\]/text|categories\[\d+\]/content[\d+\]/text

Segmentation Rules

Okapi, Java and Unicode are used for segmentation rules in SRX files.

Using regexp in SRX files is complex and at least a basic knowledge of regular expression use is recommended before attempting to work with them.

Nobreak rules (Abbreviations etc.) and Break rules (End of the sentence with a dot, etc) are in SRX files.




Invisible control character.




An uppercase letter that has a lowercase variant.


Any kind of numeric character.

\Q ... \E

Start and end of a quotation - (\QApprox.\E). This is used for Abbreviations.






Paragraph separator


Zero-width space


Ideographic full stop


Small full stop


Fullwidth full stop


Halfwidth ideographic full stop


Small question mark


Fullwidth question mark


Double exclamation mark


Question exclamation mark


Heavy exclamation mark ornament


Heavy heart exclamation mark ornament


Small exclamation mark


Fullwidth exclamation mark

Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question you can leave a public comment below or Submit a request to our Support team.
Thank you for your feedback.



Article is closed for comments.