Regular Expression - Repeat {n} Available?

2007-07-31
2012-11-13
  • Nobody/Anonymous

    I tried to use the following in a regular expression during a search and it gave the error that it can't find the word:
    ^.{10}

    What I'm trying to do is insert a space after the 10th character in every line of a data file.  I was planning on doing something like this:
    Search: "^(.{10})"
    Replace: "\1 "

    Is this not possible?  Is there a plug-in that would support more of the common regex syntax?

    Thanks,
    Matt

     
    • Chris Severance

      Chris Severance - 2007-10-01

      The RegEx function is built into the Scintilla component. For either Ctrl+F or Ctrl+R to handle it's own localized case or enhanced RegEx would be a major undertaking. The dialog would maintain it's own copy of the entire file during the replace process and would need to become modal to prevent editing.

      The best solution is to improve RegEx in the Scintilla component.

       
    • Graham Addis

      Graham Addis - 2007-08-01

      I guess you wanted to do something more sophisticated and used this as an example, but the brute force and ignorance approach would be

      Search: "^(..........)"
      Replace: "\1 "

      Graham

       
      • Nobody/Anonymous

        Yeah, I eventually just did that.  However, I had several spaces I wanted entered at specific points and it got quite tiresome.  I eventually did it all this way but it would be nice to see a more exhaustive regex ability.

         
    • Nobody/Anonymous

      Is the regex search feature handled by the TextFX plug-in?  I'd like to possibly update the code to allow for a richer regex ability.  I just need to know where this is located.

      Thanks,
      Matt

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks