Thanks very much for this Kendall, I very much appreciate it.  I managed to 
get to the same step as yourself with Grep in the end but couldn't manage 
the dashes part. 

My grep pattern is practically the same as your own:

Find:
\[(.*)\][[]]

Replace:
[\1](#\L\1\E)

I struggled a little to get the perl script going but fortunately 
Christoper Stone emailed me an Apple Script he wrote that also works well 
and I simply put in the scripts folder of BBEdit.  Thanks again.  I am 
astonished at how much help was offered to me in so short a time!

Simon.

On Sunday, August 26, 2012 8:35:22 PM UTC+1, Kendall Conrad wrote:
>
> Using just grep alone I don't see a way to fully do this. The closest I 
> could come up with is:
>
> find: \[ ([^\]]+)\]\[\]
> Replace: [ \1](#\L\1)
>
> This will turn
> [ Charging for School Activities][]
> into
> [ Charging for School Activities](#charging for school activities)
>
> This still leaves the spaces that need translating into dashes in anchor 
> portion. If you're not afraid of using Perl, you can use a unix filter.
>
> -----------
> #!/usr/bin/perl
> while (<>) {
>     if ($_ =~ m/\[ ([^\]]+)\]\[\](.*)$/) {
>         ($n2=$1) =~ tr/A-Z /a-z\-/;
>         print "[ $1](#$n2)$2\n";
>     }
>     else {
>         print "$_";
>     }
> }
> -----------
> You can run this from the #! menu.
>
> -Kendall
>
>
>
> On Sunday, August 26, 2012 11:36:05 AM UTC-4, psilas wrote:
>>
>> Hello, 
>>
>> I would like to convert Multimarkdown internal links to Pandoc ones, 
>> and from reading my BBEdit manual it seems like it would be easiest to 
>> use grep to accomplish this (that is if someone can help me with the 
>> regular expression I would need). 
>>
>> Multimarkdown handles internal links like so: 
>>
>> [ Charging for School Activities][] 
>>
>> and I use these in my table of contents to link to the Header 
>> "Charging for School Activities". 
>>
>> to do the same thing in I would to write 
>>
>> [ Charging for School Activities](#charging-for-school-activites) 
>>
>> After looking at how to use grep I realised I could spend a long time 
>> trying to get this right.  I have a long table of contents in a number 
>> of documents. 
>>
>> Can anyone help please? 
>>
>> Thanks in advance. 
>>
>> Simon. 
>>
>

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to