Announcement

Collapse
No announcement yet.

Regex Replacement + Replacement on selection

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Michael Bulgrien
    replied
    Originally posted by Chris
    1. Search > Replace doesn't have a "just selection" option, I'll add it to our wish list.
    Thanks. I, too, have asked for this in the past. Nice to know that it finally made the wish list.

    Leave a comment:


  • NeOnD
    replied
    Thanks Chris! You suggestion helps.

    Leave a comment:


  • Chris
    replied
    Here's another try, for "Search > Replace":

    1. Search > Replace doesn't have a "just selection" option, I'll add it to our wish list.

    2. To insert a # in front of lines, check "Regular Expression", then use "(.*)" as the text to find. The ".*" matches on the whole line, the parenthesis save the matched text. The matched text is saved in the variable $1, so use the replacement text "#$1".

    Leave a comment:


  • Chris
    replied
    1. Replacements affect the entire file. It isn't possible to set a replacement that is limited to a selection.

    2. "^" is a special character in regular expressions that indicates the beginning of a line. Try escaping it and using "\^" to match on the caret character.

    Edit:
    Please ignore this, I thought you were referring to the "Replacements" tab in Session > Session Settings, not "Search > Replace".
    Last edited by Chris; 07-Jan-2009, 05:14 PM.

    Leave a comment:


  • NeOnD
    started a topic Regex Replacement + Replacement on selection

    Regex Replacement + Replacement on selection

    Hi,

    I'm using BC_3.0.13. I'm working on shell scripts & I had to comment a line. What I did was I selected the line & fired the Replace "^" with "#" (with Regular Expression box checked) command. Now I have two concerns -
    1. The Replace dialog didn't have any option which works only on selection. That's the most desirable thing to have. Please include it.
    2. Nonetheless assuming the replace dialog will replace the whole file ..it came out with Text "^" not found error. Strange !!
Working...
X
😀
🥰
🤢
😎
😡
👍
👎