On Thursday 07 November 2002 9:38 am, Jean-Marc Lasgouttes wrote: > >>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: > > Lars> We used to have code in the xfroms FileDialog that made a bit > Lars> simpler for beginners, in that it allowed simple glob patterns > Lars> as well. > > Lars> Typically we just rewrote "*" -> ".*" and "." -> "\." > > Lars> I don't agree on the "long time" argument. > > You can get used to regexps in a short time if you _want_ and _need_ > to use them. We are talking about people who do not care about them, > and for whom this will only be an annoyance. I do not think that the > interface should be complicated for most people, just for the benefit > of a handful of power users. > > Let's admit it, even for people who like to use regexps, most of the > time searches in bibliography do not require them. This is just a > nifty gadget.
Sure, I wan't proposing to change the interface, just on what happens behind the scenes. If the user wants to search for a 'simple' string then we would need to pass search_expr through an RE first to ensure that all special chars are escaped. That's all. Reading the boost::regex docs: // All characters are literals except: .|*?+(){}[]^$\ // These characters are literals when preceded by a "\". This sed expression works: aleem-> search_expr='. | * ? + ( ) { } [ ] ^ $ \' aleem-> echo "${search_expr}" . | * ? + ( ) { } [ ] ^ $ \ aleem-> echo "${search_expr}" | \ > sed 's;\([]\\\.\[\|\*\?\+\(\)\{\}\^\$]\);\\\1;g' \. \| \* \? \+ \( \) \{ \} \[ \] \^ \$ \\ I suppose we can't do the equivalent in 1 line with boost, but I'm sure it woun't take 40 lines either ;-) Angus