The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Combine multiple Regular Expressions in Attachment macro

Lars Swart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 15, 2018

Hi, I have a attachment macro and want some files NOT displayed.

 

I have 3 regular expressions that work fine if I use every one of them alone

 

^((?!.*[Ss][Dd][Ss]*.*).)*$,

^((?![Ee][Ss].*).)*$,

^((?![Ss]pec.*).)*$

 

 

I combined them in one and that didnt work because of the "$" - it says here ist the end of the expression.

 

So I came up with

 

^((?!.*[Ss][Dd][Ss]*.*).)*, ^((?![Ee][Ss].*).)*, ^((?![Ss]pec.*).)*$

 

 

Still not working.  

I think the comma is used as a (text1|text2) OR expression in the background. I don't know.

 

Any ideas?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

3 votes
Answer accepted
Andrey Khaneev _StiltSoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 15, 2018

Hi Lars,

The expression should look like this:

^((?=(?!.*[Ss][Dd][Ss]*.*))(?=(?![Ee][Ss].*))(?=(?![Ss]pec.*)).)*$

Lars Swart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 15, 2018

Thank you for your very fast solution :) You made my day.

Andrey Khaneev _StiltSoft_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 15, 2018

You are welcome, Lars!

Lars Swart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 21, 2018

I recognized a small problem.

 

I have these two files which are not listed:

  • Information_questionnaire_ecolabel_declaration_raw_materials_Jungbunzlauer_en_150828.pdf
  • Statement_questionnaire_ecolabel_declaration_raw_materials_Jungbunzlauer_en_150828.pdf

 

It is because of the (?=(?![Ee][Ss].*) part.

 

It recognizes the es in the middle of "questionnaire". I thought the filter says that the word must start with [Ee][Ss]. 

 

What would be the correct syntax to filter es* at the start of a filename?

Lars Swart
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
February 21, 2018

I am not good at these...but after reading parts of this thread: https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word 

 

I added a point at the end (.*$)

 

here the complete regex:

^((?=(?!.*[Ss][Dd][Ss]*.*))(?=(?![Ee][Ss].*))(?=(?![Ss]pec.*)).).*$

 

 

for this special case the solution works. but I'm not quite sure if it fits every situation.

TAGS
AUG Leaders

Atlassian Community Events