RegEx

Help
Eric Green
2006-06-09
2012-12-07
  • Eric Green

    Eric Green - 2006-06-09

    I am trying to sync only 3 files and one folder in a directory:

    localaliases.txt
    localsearch.css
    localprefs.js

    and

    localsearches (folder)

    (there are several other files and folders in this dir)

    i tried using the simple rule set:
    ignore: .+\.*
    accept: local*

    i tried with and without recur subdir on.  I tried varios versions of this including: (localaliases.txt|localsearch.css|localprefs.js|localsearches)

    It only seems to find the files, not the folder.

    To solve it i went ahead and made two profiles.

    Any help would be awesome

     
    • Jan Kopcsek

      Jan Kopcsek - 2006-06-11

      First of all, keep in mind that we are talking about regular expressions here not wildcard expressions. So a * still means "the previous expression zero or many times". So a pattern like local* matches loca, local, locall and so on, NOT localsearches. What you mean is local.* because the dot matches any character.

      The second version with ORed file names is fine although, to be fully correct, you need to escape the dots because you don't mean "any character (.)" but "this one character called dot (\.)". Just like in your ignore pattern. As a hint: even there is a mistake: you need two dots :D. Although it's not that bad as the last part is simply not used and it matches every string.

      Yes, i know, regular expressions are a bit strange if you don't know them and there is already some wildcard pattern in CVS but for now we are only talking about regular expressions.

      Ok, lets finally see why your example doesn't work. First of all everything is ignored. Thats fine... if you then accept everything that matches "local.*" everything starting with local should get synchronized. Just testing something similar and it looks fine. Maybe it was just because of some syntactical mistakes.

       
    • Eric Green

      Eric Green - 2006-06-12

      that makes a lot more sense.  I tried:

      ignore: .* 
      accept: local.*

      Although my new trouble is that nothing in the localsearches folder in being synced (um, sunk?).  None of the files, of course, start with local.

      I assumed that the reg ex would be based on the relative path of the files and folder.  That is, the contents of the folder localsearches would pass the accept clause since its path is localsearches/myfile.txt.  Obviously, not the case.

      Is there a solution or should i stick with two seperate profiles?  What a great app tho!!!

       
    • Jan Kopcsek

      Jan Kopcsek - 2006-06-12

      Good to hear it works and yes, no files not starting with local will now be synced no matter where they are. I know this is a bit different to many other apps which match the path instead of the file name.

      For now you will need two profiles... the next version will have a better rule system that will help you but i don't know when this one will be released (no promises and stuff ;))

       

Log in to post a comment.