Click here to Skip to main content

Regular Expressions

 
GeneralRe: Rename File Name Help [modified] Pinmembertoikken6-Aug-12 16:05 
GeneralRe: Rename File Name Help PinmemberBernhard Hiller6-Aug-12 21:24 
QuestionSwap two values based on pattern Pinmemberbiop.codeproject2-Aug-12 18:19 
AnswerRe: Swap two values based on pattern PinmemberPeter_in_27802-Aug-12 20:02 
GeneralRe: Swap two values based on pattern Pinmemberbiop.codeproject3-Aug-12 0:43 
GeneralRe: Swap two values based on pattern PinmemberPeter_in_27803-Aug-12 1:08 
GeneralRe: Swap two values based on pattern Pinmemberbiop.codeproject5-Aug-12 17:09 
GeneralRe: Swap two values based on pattern [modified] Pinmemberbiop.codeproject5-Aug-12 18:12 
Well I find out the result myself using sed! Well with the help from using sed. After some search, I find out I can do the following:
 
1. Find bracket [ or ]
- I need to escape this in search string (\[ or \])
- To search for [abc] -> \[\([a-z]*\)\]
 
2. Find parentheses ( or )
- I do not escape this in search string
- To search for (123) -> (\([0-9]*\))
 
3. Use simple [a-z] or [0-9] instead of \S, \w, \d
 
Therefore I have:
echo [abc](123) | sed -e "s/\[\([a-z]*\)\](\([0-9]*\))/\2 \1/"
 
Output:
123 abc
 
So in emacs, I do the following:
1. M-x regular-regexp
2. \[\([a-z]*\)\](\([0-9]*\))
3. \2 \1
(Make sure there is a space between \2 and \1.)

modified 5-Aug-12 23:32pm.

GeneralRe: Swap two values based on pattern PinmemberPeter_in_27805-Aug-12 18:59 
QuestionRegEx Problem PinmemberKevin Marois19-Jun-12 13:12 
AnswerRe: RegEx Problem [modified] PinprotectorAspDotNetDev19-Jun-12 13:34 
GeneralRe: RegEx Problem PinprotectorAspDotNetDev19-Jun-12 13:52 
GeneralRe: RegEx Problem PinmemberKevin Marois19-Jun-12 14:02 
AnswerRe: RegEx Problem PinprotectorAspDotNetDev19-Jun-12 14:35 
Questioncan someone tell me whats wrong with this expression? [modified] PinmemberChekGuy29-Apr-12 12:48 
AnswerRe: can someone tell me whats wrong with this expression? Pinmemberegenis29-Apr-12 20:22 
AnswerRe: can someone tell me whats wrong with this expression? PinmemberPeter_in_278029-Apr-12 20:46 
QuestionEither start or not a "d" PinmemberBernhard Hiller6-Mar-12 1:50 
AnswerRe: Either start or not a "d" PinmemberBernhard Hiller6-Mar-12 3:02 
QuestionTrying to match non-quoted sections [modified] PinmemberPIEBALDconsult24-Jan-12 5:30 
AnswerRe: Trying to match non-quoted sections PinmemberAndreas Gieriet7-Apr-12 5:33 
GeneralRe: Trying to match non-quoted sections PinmemberPIEBALDconsult7-Apr-12 10:17 
GeneralRe: Trying to match non-quoted sections PinmemberAndreas Gieriet7-Apr-12 12:04 
GeneralRe: Trying to match non-quoted sections PinmemberPIEBALDconsult9-Apr-12 19:03 
GeneralRe: Trying to match non-quoted sections PinmemberAndreas Gieriet10-Apr-12 10:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 13 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid