How do I change my regex to include also max. number of words?
Thread poster: Fredrik Pettersson
Fredrik Pettersson
Fredrik Pettersson  Identity Verified
Hong Kong
Local time: 09:27
Member (2009)
English to Swedish
+ ...
Feb 16

I have this regex now:

(\w+\s+){4}\w

I want that it also states max. 5 number of words to filter on. How do I add that condition in my regex?


 
Stepan Konev
Stepan Konev  Identity Verified
Russian Federation
Local time: 10:27
English to Russian
^(?:[\w]+\s){0,4}[\w]*[\s\.?!;\,]*$ Feb 16

If you want to capture segments consisting of up to 5 words, either with or without punctuation marks or space at the end, you need this regex: ^(?:[\w]+\s){0,4}[\w]*[\s\.?!;\,]*$

 
Fredrik Pettersson
Fredrik Pettersson  Identity Verified
Hong Kong
Local time: 09:27
Member (2009)
English to Swedish
+ ...
TOPIC STARTER
Regex for max/min number of words Feb 19

Works excellent to use your new regex for this project. Thanks a lot Stepan!

 


To report site rules violations or get help, contact a site moderator:

Moderator(s) of this forum
Laureana Pavon[Call to this topic]

You can also contact site staff by submitting a support request »

How do I change my regex to include also max. number of words?






Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »