Question for Regex

Tool for Search and Replace across multiple files.
Post Reply
BoldText
Posts: 3
Joined: Fri Mar 16, 2018 3:01 pm

Question for Regex

Post by BoldText »

Hello,

I want use this multi-line regex

array$[\t\n\r\s]*?\([\t\s]*?$

for searching array without "(" behind it, but next new line. The regex working fine in php or Online Regex tests. https://regex101.com/r/YyHZaU/1

In TextCrawler-Tool "Test Regular Expression" and "Find" its not working. I missing here somthing?
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Question for Regex

Post by DigitalVolcano »

Have you tried using the Multi line anchors option in TextCrawler?

If that doesn't work, can you provide an example string that you are trying to match?
Thanks!
BoldText
Posts: 3
Joined: Fri Mar 16, 2018 3:01 pm

Re: Question for Regex

Post by BoldText »

Yes, I checked "Multi line anchors" option. You can use the text from my link for testing regex. ;)

Code: Select all

text array
text
text array
	(
text array(
	(
text array
(
text
text array
   (	
text
text (array
		(
array
text array
		(
text
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Question for Regex

Post by DigitalVolcano »

This works as per the example

Code: Select all

array(\r\n|\r|\n)[\t\n\r\s]*?\([\t\s]*?$
It doesn't seem to like the first line-ending ($) symbol in the original expression?
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Question for Regex

Post by DigitalVolcano »

Looks like a quirk in .NET Regular Expressions
https://stackoverflow.com/questions/861 ... match-crlf
BoldText
Posts: 3
Joined: Fri Mar 16, 2018 3:01 pm

Re: Question for Regex

Post by BoldText »

Thanks for your help! That was it! :)
Post Reply