Results 1 to 6 of 6

Thread: Any Regex gurus out there? (regular expression)

  1. #1
    Join Date
    Apr 2006
    Posts
    25

    Default Any Regex gurus out there? (regular expression)

    Usually I can piece something together by trial and error without deep regular expression syntax expertise, but I am thrashing on this pattern:

    "for example in <a href="../bible/2ki019.htm#2">2 Kings 19:2</a>; <a href="../bible/2ch026.htm#22">2 Chronicles 26:22</a>; <a href="../bible/2ch032.htm#20">32:20-32</a>, it is read"


    The "after" result would look as follows:

    "for example in 2 Kings 19:2; 2 Chronicles 26:22; 32:20-32, it is read"

    Thanks,
    Steve
    Steve MacKenzie
    Bellevue, WA

  2. #2
    Join Date
    Apr 2004
    Posts
    2,093

    Default

    Quote Originally Posted by Comet View Post
    Usually I can piece something together by trial and error without deep regular expression syntax expertise, but I am thrashing on this pattern:

    "for example in <a href="../bible/2ki019.htm#2">2 Kings 19:2</a>; <a href="../bible/2ch026.htm#22">2 Chronicles 26:22</a>; <a href="../bible/2ch032.htm#20">32:20-32</a>, it is read"


    The "after" result would look as follows:

    "for example in 2 Kings 19:2; 2 Chronicles 26:22; 32:20-32, it is read"

    Thanks,
    Steve
    I am using Word:
    make sure to check the box "use wildcards" in Search options

    Find replace #1
    Find: \<a href="../bible*"\>
    replace: (space or nothing)

    Find replace #2
    Find: \<\/a\>
    replace: (space or nothing)
    Michael Hanel
    PhD candidate Classics Univ. of Cincinnati
    MDiv Concordia Seminary
    MA Classics Washington University
    Unofficial BibleWorks Blog
    LibraryThing!

  3. #3
    Join Date
    Apr 2006
    Posts
    25

    Default

    Thanks for the quick reply. The problem is that there are other </a> tags other than the bible ones.

    But you gave me a good idea that I should probably try FAR or another editor with search and replace built in rather than trying to roll my own expressions with perl scripts.

    Thanks,
    Steve
    Steve MacKenzie
    Bellevue, WA

  4. #4
    Join Date
    Apr 2004
    Posts
    2,093

    Default

    Quote Originally Posted by Comet View Post
    Thanks for the quick reply. The problem is that there are other </a> tags other than the bible ones.

    But you gave me a good idea that I should probably try FAR or another editor with search and replace built in rather than trying to roll my own expressions with perl scripts.

    Thanks,
    Steve
    Well see you didn't say it was *that* tricky Off the top of my head, if you use FAR, simply modify the start and end point so that it begins sniffing at "\<a href="../bible", marks a stop of one variable at ""\>", then goes all the way to "\<\/a\>", but keeps the text in the middle. FAR is pretty good at searches like that, but be sure to back up your text before you start playing around. I've made that mistake a few times before!
    Michael Hanel
    PhD candidate Classics Univ. of Cincinnati
    MDiv Concordia Seminary
    MA Classics Washington University
    Unofficial BibleWorks Blog
    LibraryThing!

  5. #5
    Join Date
    Apr 2006
    Posts
    25

    Default

    Yes, I am going over the FAR docs now. I'll get it now.
    Thanks!
    Steve
    Steve MacKenzie
    Bellevue, WA

  6. #6
    Join Date
    Apr 2006
    Posts
    25

    Default

    OK, got it with FAR. You can use the $0-$ that will replace the current match without the defined start and end.

    Pretty amazing tool.

    Yes, I copy backups all over the place with foldernames that identify their "state".

    Steve
    Steve MacKenzie
    Bellevue, WA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •