faubackup2/src/regexp regexp.cpp,1.4,1.5
Erik Merkel <[email protected]> Tue, 28 Jun 2005 22:26:15 +0000
| Newsgroups | gmane.comp.sysutils.backup.faubackup.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/faubackup/faubackup2/src/regexp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3338/src/regexp
Modified Files:
regexp.cpp
Log Message:
better regexp: now it's possible to use all characters for filenames /
patterns
user can escape chars not to be interpreted as shell pattern - e.g. \* is
treated as a char and not as a pattern
quotation marks inside filenames are now interpreted as q-marks and not as
delimiters (the outer q-marks are still used)
1; and lines starting with $ are treated as commentline for compatibility
with old faubackup
Index: regexp.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/regexp/regexp.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** regexp.cpp 14 Jun 2005 20:23:35 -0000 1.4
--- regexp.cpp 28 Jun 2005 22:26:12 -0000 1.5
***************
*** 13,18 ****
string filterUnwantedChars(string String)
{
! //filter any char that is not valid in filenames nor is a joker sign; convert tabs into one whitespace
! static const boost::regex expression("([[:space:]])|([^[:word:][.right-square-bracket.][.left-square-bracket.][.hyphen.]*+?~#./])");
string output_format("(?1 )");
return boost::regex_replace(String, expression, output_format, boost::match_default | boost::format_all);
--- 13,18 ----
string filterUnwantedChars(string String)
{
! //convert tabs into one whitespace
! static const boost::regex expression("([[:space:]])");
string output_format("(?1 )");
return boost::regex_replace(String, expression, output_format, boost::match_default | boost::format_all);
***************
*** 24,44 ****
static const boost::regex conversation_exp
(
! "(\\*\\*)|" // ?1 **
! "(\\*)|" // ?2 *
! "(/\\./)|" // ?3 ./
! "(\\?)|" // ?4 ?
! "(//*)|" // ?5 if multiple / is present
! // ?6 replace all other special regex symbols with its literals
! "([[.right-square-bracket.][.left-square-bracket.].\\\\|+(){}$^])"
);
static const std::string conversation_replace =
(
! "(?1.*)"
! "(?2[^/]*)"
! "(?3/)"
! "(?4[^/])"
! "(?5/)"
! "(?6\\\\$&)"
);
--- 24,46 ----
static const boost::regex conversation_exp
(
! "(\\\\.)|" // ?1 user escaped something
! "(\\*\\*)|" // ?2 **
! "(\\*)|" // ?3 *
! "(/\\./)|" // ?4 ./
! "(\\?)|" // ?5 ?
! "(//*)|" // ?6 if multiple / is present
! // ?7 replace all other special symbols with its literals
! "([^[:word:]^[:space:]])"
);
static const std::string conversation_replace =
(
! "(?1$&)"
! "(?2.*)"
! "(?3[^/]*)"
! "(?4/)"
! "(?5[^/])"
! "(?6/)"
! "(?7\\\\$&)"
);
***************
*** 64,68 ****
bool commentLine(string String)
{
! static const boost::regex test("[\\s]*#.*|[^\\d\\w]*|\\n");
boost::match_results<string::iterator> what;
--- 66,73 ----
bool commentLine(string String)
{
! static const boost::regex test("[\\s]*#.*|[^\\d\\w]*|\\n"
! /*used for compatibility with old faubackup */
! "|[\\s]*1;.*"
! "|[\\s]*$.*");
boost::match_results<string::iterator> what;
***************
*** 683,687 ****
string getBackupRuleString(string String)
{
! static const boost::regex expression("[\\s]*.+\"(.+)\"[\\s]*.+");
boost::match_results<string::iterator> what;
--- 688,692 ----
string getBackupRuleString(string String)
{
! static const boost::regex expression("[\\s]*[^\"]+\"(.+)\"[\\s]*[^\"]+");
boost::match_results<string::iterator> what;
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click