Runtime error '13' : type mismatch

Things you’d like to miss in the future...
Post Reply
j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Runtime error '13' : type mismatch

Post by j_c_hallgren »

Ok...so I was getting bold and adventurous...so I tried to do a RegEx find..
I musta made a BIG boo-boo cause I got an error.."Unexpected Quantifier. Ensure your search pattern is properly constructed"...fine...but then after clicking on that, I get a "Runtime error 13" and the name and location boxes get cross-hatching...and then as usual, XY exits out...

The failing RegEx entry was ">*.(bmp|jpg)"

RalphM
Posts: 1935
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Runtime error '13' : type mismatch

Post by RalphM »

j_c_hallgren wrote:Ok...so I was getting bold and adventurous...so I tried to do a RegEx find..
I musta made a BIG boo-boo cause I got an error.."Unexpected Quantifier. Ensure your search pattern is properly constructed"...fine...but then after clicking on that, I get a "Runtime error 13" and the name and location boxes get cross-hatching...and then as usual, XY exits out...

The failing RegEx entry was ">*.(bmp|jpg)"
Well there are a couple of differences between standard search patterns and RegExp ones, following the RegExp meanings:

. (dot) Matches any single character except line break characters \r and \n.
* (star) Repeats the previous item zero or more times.

So, you actually used the repeat char before there wasn't anything to repeat.

Try this one instead, which worked here: ">.*(bmp|jpg)"
Ralph :)
(OS: W11 22H2 Home x64 - XY: Current beta - Office 2019 32-bit - Display: 1920x1080 @ 125%)

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

RalphM, so that would be proper RegEx to look for all .BMP and .JPGs?
I'm wanting to combine "*.bmp" and "*.jpg" patterns...

It seems to find other files with JPG and BMP as part of name and not an extension...that was my goal...and I didn't see any example that appeared to match this type of search...

In any case, it shouldn't really "crash & burn" if a bad regex is input...

admin
Site Admin
Posts: 60590
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

j_c_hallgren wrote:In any case, it shouldn't really "crash & burn" if a bad regex is input...
Damn it, no it shouldn't! Just fixed it, thanks!

RegExp pattern (as given by RalphM): >.*(jpg|bmp)
Boolean pattern: *.jpg | *.bmp

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

Seems that regex needs a tweak to be more similar to boolean results..
>.*(.bmp|.jpg)
Had to add a "." before the extensions to avoid finding it within the name...as in tbmpadding.txt would have matched before...however, I still get undesired matches on text.jpg-somename.xyz style names...

admin
Site Admin
Posts: 60590
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Me speak no RegExp --- others may help!

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

:x Ok, so I'm NOT really mad...was just a bit irritated...I somehow managed to get that bad regex saved so that when I tried to close 2nd tab, it would then contantly crash on tab 1! :o
I looked in the INI file but didn't see the regex...ok...so where would it be hiding? :?

Ah-ha! Saw the FindTemplates folder...maybe there?..yes! Found the regex in tab_2.dat! So edited it to a valid string and all is well... :)

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

here's the beast ;)
>.*(.bmp|.jpg)$

$ means end of line, so we used it to specify there's nothing more after (.bmp|.jpg)

FYI the other way around ^ is the sign for beginning of line, so:
>^toto
should match all file starting with toto (like toto*)

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

8) Thanks jacky!

I'd also suggest that this simple boolean example be added to Help file and/or XED page as a real-world usage...adding the regex might be good too...

admin
Site Admin
Posts: 60590
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

jacky wrote:here's the beast ;)
>.*(.bmp|.jpg)$
Not quite: it also finds "filejpg" but should only find "file.jpg". The dot must be escaped:
>.*(\.bmp|\.jpg)$

Post Reply