0

I've inside my company a deployment process called XL-Deploy.

XL-Deploy give me possibility to replace some mustach variable by value stored in XL-Deploy library like Jenkins for comparison.

My problem with this application come with file extension. Yes, XL-Deploy need to specify using regexp wich file type need to be scan for variable replacement.

I'm not a pro with regexp but my company give me this regexp work perfectly when file are basic (foo.bar, index.php, test.html, etc..) but in my case not working because my config file name is config.ini.php.

I've try 1 day without success to create regexp working for exclude my config.ini.php.

Original work regexp for all file following this pattern: index.html, test.php, foo.bar (.+.(?!php).*)

I've try (.+.(?!ini\.php).*) but for an unknow reason i dont understand when i add dot in negative lookahead my group stop working, because i need a matching for config.ini.php.

Thank you in advance for your help really needed :)

Have a good dev

William

  • Check the two links on top if the question, those should solve your problem. Also, to match a literal `.` you need to escape it. – Wiktor Stribiżew Jun 29 '20 at 08:53
  • Sorry, i'v miss escape in my exemple, i've try (.+.(?!ini\.php).*) without success. When i try without using negative lookahead, config.ini.php matching work perfect, but when i use negative lookahead, is not working. – William Rudent Jun 29 '20 at 09:04
  • Sure, it won't work, please see the linked solutions. – Wiktor Stribiżew Jun 29 '20 at 09:06
  • i've try with **\\.** syntax after reading post. Not working for this solution, but i continue reading – William Rudent Jun 29 '20 at 09:28
  • Escaping is not the solution. A correct expression to match a string not ending with another (say, `.ini.php`) is `^(?!.*\.ini\.php$).*` – Wiktor Stribiżew Jun 29 '20 at 09:31
  • I've also try this (.+\.(?!php|ini).*) working on all regexp online tester but not with the prod deployment app – William Rudent Jun 29 '20 at 09:34
  • Your regex does not make sense anyway. Do you want to match any string not containing `.php` or `.ini`? Then you need `^(?!.*\.(?:ini|php)).*`. Check which regex flavor the tool supports. Also, consider asking the product support, here, your question is off-topic. – Wiktor Stribiżew Jun 29 '20 at 09:40
  • https://regexr.com/57h58 This exemple exclude all file beginning with dot and file with php extension. I need to do the same effect with file with .ini.php extension. – William Rudent Jun 29 '20 at 09:48

0 Answers0