Author Topic: [Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp  (Read 1024 times)

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
[Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp
« on: September 20, 2016, 01:33:53 PM »
Not sure if it's a bug or if I didn't understood weidu documentation. This test code:
Code: [Select]
ACTION_IF (NOT FILE_CONTAINS_EVALUATED (~GTIMES.IDS~ ~[ %TAB%]ONE_MINUTE[ %TAB%]*$~)) BEGIN
PRINT ~regexp not recognized~
END
prints the message as if the ONE_MINUTE was not present within GTIMES.IDS. This code:
Code: [Select]
ACTION_IF (NOT FILE_CONTAINS_EVALUATED (~GTIMES.IDS~ ~ ONE_MINUTE~)) BEGIN
PRINT ~regexp not recognized~
END
works fine (message not printed)

And according to documentation:
Quote
FILE_CONTAINS_EVALUATED ( fileName varsRegexp )
First, all WeiDU variables enclosed in %s in varsRegexp and fileName are substituted. The expression is 1 if the resulting regexp occurs in fileName and 0 otherwise. If fileName does not exist or has size 0, the result is 0. The comparison ignores case.
« Last Edit: September 20, 2016, 02:04:30 PM by K4thos »

Offline Argent77

  • Planewalker
  • *****
  • Posts: 177
Re: [Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp
« Reply #1 on: September 20, 2016, 02:37:03 PM »
FILE_CONTAINS_EVALUATED doesn't appear to like the end-of-line matcher '$' in regular expressions.

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
Re: [Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp
« Reply #2 on: September 20, 2016, 02:51:33 PM »
ah, indeed. I even used something like this at some point to make end of line detectable (or maybe it was the other way around):
Code: [Select]
REPLACE_TEXTUALLY ~%WNL%~ ~%LNL%~Completely forgot about it. Thanks.

So, Wisp, any chance to make $ special character to work with both %LNL% and %WNL%? It's not really crucial since my usage of $ in code was excessive either way but maybe worth considering if it's not much of work,
« Last Edit: September 21, 2016, 03:25:47 AM by K4thos »

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 297
  • Gender: Male
Re: [Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp
« Reply #3 on: September 20, 2016, 08:04:47 PM »
From earlier discussions, I think the regexp matching is entirely handled by OCaml.  In their flavour of regexp, the $ symbol matches before LF but not before CR.
« Last Edit: September 20, 2016, 08:05:18 PM by Mike1072 »

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
Re: [Bug?] FILE_CONTAINS_EVALUATED doesn't recognize regexp
« Reply #4 on: September 21, 2016, 12:21:01 AM »
Quote
From earlier discussions, I think the regexp matching is entirely handled by OCaml.  In their flavour of regexp, the $ symbol matches before LF but not before CR.
Damn, it was me who started that discussion like a year ago with almost the exact same question. How on earth I forgot about it (and made regression in EET due to it) is beyond me :o

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: