Logout

Alt-N Discussion Groups > MDaemon Discussion Groups > MDaemon Content Filter > Regular Expressions.

 [F] Alt-N Discussion Groups  / MDaemon Discussion Groups  / MDaemon Content Filter  /

Regular Expressions.

[Ulyanov, Alex]
Alex Ulyanov
Newbie
Newbie
Posts: 36
Alex Ulyanov - 02:14pm, Oct 23 2017

Hello, need some help here.
I'm trying to write a regex to match a whole word in a sentence but not any substrings, e.g.

match exactly "rocket" but not "sprocket" and not "rocket-launcher"

Tried to use perl-style /b:

/b(rocket)/b

but got nothing of it.

  (older msg: 7)All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items

Alex Ulyanov - Jan 9, 2018 12:37 pm (#8 Total: 10)  

 

Photo of Author
Alex Ulyanov
Newbie
Newbie
Posts: 36
Arron I have no messages near at hand. Actually we don't need them. I'm stuck just athe very first step. Let me show you. Please, see attached screenshots below.

First I use an english word "test" to demonstrate that my regex works correct.

Then I try to match a word "book" but written in russian language (). That doesn't work where it should.
Right after that I try another word in russian and catch an error in regex.

It seems the reason is the codepage mdaemon uses.


1


3


4

Arron Caruth - Jan 11, 2018 12:42 pm (#9 Total: 10)  

Guest User  

Photo of Author
Posts: 1

I think we figured out what is going on.

 

The Word boundary “\b” in the regular expression implementation we are using only works with A-Z, a-z, or 0-9.  It won’t work with Russian characters.

 

As an alternative the following regular expression should be pretty close to what you need.

 

(^|[\W]+|[^char_range]+)операци($|[\W]|[^char_range]+)

 

Where “операци” is the word you are looking for.  And in order for this to work you’ll need to replace the phrase “char_range” with the Russian range of characters.

--

Arron Caruth
Director of Product Development
o: 817.601.3222    e: arron.caruth@mdaemon.com

MDaemon Technologies
Simple Secure Email

Visit us on Facebook | LinkedIn | YouTube

Sent using the MDaemon Messaging Server

 

From: md-cfilter@mdaemon.com [mailto:md-cfilter@mdaemon.com] On Behalf Of Alex Ulyanov
Sent: Tuesday, January 9, 2018 11:38 AM
To: md-cfilter List Member <md-cfilter@mdaemon.com>
Subject: [md-cfilter] Regular Expressions.

 

Arron I have no messages near at hand. Actually we don't need them. I'm stuck just athe very first step. Let me show you. Please, see attached screenshots below.

First I use an english word "test" to demonstrate that my regex works correct.

Then I try to match a word "book" but written in russian language (êíèãà). That doesn't work where it should.
Right after that I try another word in russian and catch an error in regex.

It seems the reason is the codepage mdaemon uses.

Attachment: 1.PNG
Attachment: 3.PNG
Attachment: 4.PNG


View/reply at Regular Expressions.

 
 
--MD-CFILTER---------------------------------------------------------
This list is for questions and discussions about MDAEMON's Content 
Filter. To unsubscribe from this mailing list send an email to 
md-cfilter-unsubscribe@mdaemon.com .
--POWERED BY MDAEMON!------------------------------------------------
 
---------------------------------------------------------------------
These forums are provided by MDaemon Technologies for user-to-user 
support and discussion.  MDaemon staff members may participate in the 
forums periodically but please recognize that this is not the official
method of receiving technical support. To receive personal technical 
support please use the form here:
http://www.mdaemon.com/Support/RequestSupport/
---------------------------------------------------------------------

Alex Ulyanov - Jan 12, 2018 4:43 am (#10 Total: 10)  

 

Photo of Author
Alex Ulyanov
Newbie
Newbie
Posts: 36
) As an alternative the following regular expression should be pretty close to what you need.

Sorry, but that doesn't work with all russian chars.

Well, Arron, I see it's a bit difficult to use for now. So I decided to stop these regexp attempts.

I'll better wait until international chars would be fully supported.

Thanx anyway!

[Last Editor: Alex Ulyanov, Jan 12, 2018 4:44 am. Total Edits: 1]



  All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items



 Content:

Read New | Search

 Guest:

Email to Admin



You are visiting as a Guest user.