What you have here isn't a replacement that I'd do with a regular expression. When using Regular expressions, you should utilize the Microsoft Regex documentation. Where regular expressions work best are for grouping matches, backreferences, etc. In .NET, these elements can be addressed a number of different ways the most common being $[#]. There was another question that was just asked about moving data between a $a and $z -- this would be a good place to utilize a regular expression. You may want to look at that reply to get a better idea of how regular expressions are setup in MarcEdit. Likewise, there are a number of responses in the MarcEdit-L archive that have examples of doing replacements with regular expressions.
--TR
> -----Original Message-----
> From: MarcEdit support in technical and instructional matters
> [mailto:[log in to unmask]] On Behalf Of Kristina M. Spurgin
> Sent: Monday, February 01, 2010 9:28 AM
> To: [log in to unmask]
> Subject: [MARCEDIT-L] Replacing with regular expressions.
>
> Hi all,
>
> I'm having trouble getting regular expressions to work properly in
> replacements. I feel like I must be missing some obvious thing...
> perhaps someone can recognize what is amiss.
>
> I am using MarcEdit 5.2.3649.36949 on Windows XP Professional.
> Microsoft's ConfChecker utility says I have MDAC 2.8.
>
> The MarcEdit documentation says:
> Using the Replace Function, this same expression would be written like:
> In the Find Text Textbox: ab
> In the Replace With Textbox: \01xx
> Check the Use Regular Expression option
>
> I added this field to each record in my file to test:
> =999 $aaabbcc $bxxyyzz
>
> -=-=-=-=-=
> Test 1
> -=-=-=-=-=
> I go to Tools > Edit subfield data.
>
> I unclick Match case
>
> I click Use regular expression
>
> In Field, I type:
> 999
>
> In Subfield, I type:
> b
>
> In Field data, I type:
> yy
>
> In Replace with, I type:
> \01pp
>
> (I make sure "use regular expressions" is checked --- it is!)
>
> I click "Replace Text"
>
> I expect my $b to be changed to:
> xxyyppzz.
>
> My $b is ACTUALLY:
> xx\01ppzz
>
> -=-=-=-=-=
> Test 1b
> -=-=-=-=-=
> All of the above is left the same EXCEPT:
> I change Field Data to:
> (yy)
>
> My $b is still:
> xx\01ppzz
>
> -=-=-=-=-=
> Test 1c
> -=-=-=-=-=
> I revert Field Data to:
> yy
>
> I change Replace with to:
> \1pp
>
> My $b becomes:
> xx\1ppzz
>
> I tried the same things in the plain Replace tool (Ctl-R).
>
> I also tried a number of other different things, based on the Grouping
> Constructs documentation provided by Microsoft. Nothing worked.
>
> I've included the above because they are pretty much identical to what
> the MarcEdit docs say should work (unless I'm missing something
> obvious). Any ideas why this isn't working for me?
>
> Thanks!
> -Kristina
>
> Kristina Spurgin
> E-Resources Cataloger | E-Resources & Serials Management
> UNC Chapel Hill | CB#3938, Davis Library | Chapel Hill, NC 27514-8890
> [log in to unmask] | (919) 962-2050 | ext. 357
>
> _______________________________________________________________________
> _
>
> This message comes to you via MARCEDIT-L, a Listserv(R) list for
> technical and instructional support in MarcEdit. If you wish to
> communicate directly with the list owners, write to MARCEDIT-L-
> [log in to unmask] To unsubscribe, send a message "SIGNOFF
> MARCEDIT-L" to [log in to unmask]
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
|