2011-11-01 18 views
7

विम के भीतर कुछ वर्ण अनुक्रम उपयोग \ (\) की आवश्यकता है। वही व्यवहार अन्य विशेषताओं के लिए है: \ {\}।क्या vim regexp बोली को बदलना संभव है?

क्या रेगेक्स शैली को पर्ल में बदलना संभव है? इसे कैसे स्विच करें?

इसके बजाय

\\(

मैं करूंगा

(

???

उत्तर

11

आप डिफ़ॉल्ट बदल सकते हैं 'जादू स्तर' आवश्यक

:se nomagic 
:se magic 

:he magic

देखें मैं बजाय इसी पलायन का उपयोग कर अपने अन्य मैपिंग को तोड़ने से बचने के लिए सलाह देते हैं।

/\v(\d+) 

लगातार अंक से मेल खाएगी की तरह आप पर्ल Regex

साथ उम्मीद थी pattern.txt मदद से:

Examples: 
after: \v  \m  \M  \V   matches ~ 
       'magic' 'nomagic' 
      $  $  $  \$   matches end-of-line 
      .  .  \.  \.   matches any character 
      *  *  \*  \*   any number of the previous atom 
     ()  \(\)  \(\)  \(\)  grouping into an atom 
      |  \|  \|  \|   separating alternatives 
      \a  \a  \a  \a   alphabetic character 
      \\  \\  \\  \\   literal backslash 
      \.  \.  .  .   literal dot 
      \{  {  {  {   literal '{' 
      a  a  a  a   literal 'a' 

{only Vim supports \m, \M, \v and \V} 

It is recommended to always keep the 'magic' option at the default setting, 
which is 'magic'. This avoids portability problems. To make a pattern immune 
to the 'magic' option being set or not, put "\m" or "\M" at the start of the 
pattern. 
+0

खेद @Johnsyweb, एक साथ संपादन :) मदद के लिए धन्यवाद! – sehe

संबंधित मुद्दे