Search & Replace: Wildcards - Examples for Learning

General questions about using WildEdit

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
MT_MANC
Posts: 10
Joined: Sat May 03, 2008 1:02 pm

Search & Replace: Wildcards - Examples for Learning

Post by MT_MANC »

Where can attempt to learn S & R using wildcards & RegExps from concrete examples ? WildEdit Help has lots of stuff on RegExp etc but I cant find any examples of S & R using Wildcards ?

Nothing readily obvious on the recent Forum history either

PROBLEM
I want to extend a generic text line that is similar across seperate ASCCI text files (*.TAB) ie replace
Find What:"NETXadj_c pctave Latest Run1"
with
Replace with:"NETXadj_c pctave Latest Base NETXadj_c pctave Run1 Base"
across 100 different (2 or 3 character) suffix types (eg "_c", "_u", "_j", "_sk", "_no" etc)


If I specify (NB speech marks absent when specifying in WildEdit):
Find What:"NETXadj_.* pctave Latest Run1"
with
Replace with:"NETXadj_ pctave Latest Base NETXadj_ pctave Run1 Base"
[ with RegExp boxed ticked and "In Files Matching: *.TAB" ]

it doesnt seem to work - how exactly do I specify the "Replace with:" string ??

OR more simply, say I just wanted to replace:
Find What: NETXadj_c pctave Latest Run1
with
Replace with: NETXadj_c pctave Latest Base
[ with RegExp boxed ticked and "In Files Matching: *.TAB" ]

across 100 different (2 or 3 character) suffix types (eg "_c", "_u", "_j", "_sk", "_no" etc)
how would I specify this with RegExp (or Replacement Format ?)


(NB In DOS Wildcards I would use:
"NETXadj_? pctave Latest Run1" => "NETXadj_? pctave Latest Base"
AND
"NETXadj_?? pctave Latest Run1" => "NETXadj_?? pctave Latest Base" )
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Regular expressions are quite different from wildcard expressions. Regular expressions are far more versatile.

Is this what you need?
Find what: NETXadj_([a-z]+) pctave Latest Run1
Replace with: NETXadj_$1 pctave Latest Base NETXadj_$1 pctave Run1 Base

[X] Regular expression
[X] Replacement format
There are many regular expression tutorials on the web, and you will find recommendations for some of them if you search this forum.

A standard reference for regular expressions is

Friedl, Jeffrey E F
Mastering Regular Expressions, 3rd ed
O'Reilly, 2006
ISBN: 0-596-52812-4
http://regex.info/
Post Reply