Jump to content
Muxe Inc Forums
Sign in to follow this  
Avchent

FindFile, RegExp, Trouble

Recommended Posts

Avchent    0

Hello All!

 

I often use "Find File" for search in the NDN.

But there is a little trouble.

For example, I would like to find files with pattern like that:

<when>...<####>....<dram>

 

For that purpose I press Alt-F7,

type RegExp: "when\s*(\w\S*\s*)*dram"

and press <Enter>.

 

File "bootrom.inc" (see attached file) has this pattern (Line 210),

but "Find File" command can't find it.

 

As far as I know "Find file" command uses "viewer"-mode for search.

Indeed if I open "bootrom.inc" in an internal viewer (F3) then I can't

find pattern, but if I open "bootrom.inc" in an editor (F4) then I can do it.

 

I have checked NDN v2.15.4000(ENG) and v2.15.7555(ENG). Both have

this trouble.

 

Conclusion: if you use "Find File" command (Alt-F7) you can't be

sure about results of search. You may find less files than there are in fact.

BOOTROM.ZIP

Share this post


Link to post
Share on other sites
GPFault    0

Hi Avchent!

Your regexp "when\s*(\w\S*\s*)*dram" produce extremely large search tree. And very low speed of search as consequence.

Also notice that in viewer line ends are treated as \s.

In bootrom.inc file the word "when" appears much before the line you search for and NDN regexp engine (as i know it`s PCRE lib) reach recursion limit before it finds "dram".

There is no such problem in editor because it search separately in each line.

Try to use "when\s*(\w\S*\s+)*dram" - it is extremly faster and works fine.

(+ means >=1 times)

If you want really 100% equivalent to your search pattern try "when\s*(\w\S*\s+)*(\w\S*)?dram". It works fast too.

Strictly saying that`s a bug that NDN fail on your regexp but i tried to search for same pattern in your file in PsPad editor - it hangs.

So i`m not sure if your regexp is supported by some regexp engine...

Also replace "\s" with "[ \t]" if you don`t want multiline matches, like in

when there
some other text
is no dram

Share this post


Link to post
Share on other sites
Avchent    0

Hi GPFault!

 

Thank you for you reply.

 

>Your regexp "when\s*(\w\S*\s*)*dram" produce extremely large

>search tree. And very low speed of search as consequence.

Really it worked with low speed.

 

>Try to use "when\s*(\w\S*\s+)*dram" - it is extremly faster and works fine.

I tried it - cool! Thank you.

Of course there had to be "\s+" - at least one space (tab) must be.

 

>Also replace "\s" with "[ \t]" if you don`t want multiline matches.

Yes, i meant exactly SPACE or TAB between words.

 

Thanks a lot. Your explanations were very useful.

 

Sorry for my wrong conclusion about RegExp in NDN. I was not right.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×