EmEditor (text editor) Forum Index
   Regular Expressions
     Needs help in writing regex in snippets
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
ToadLoadin
Posted on: 12/22/2009 5:25 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Needs help in writing regex in snippets
The new snippet plugin is really powerful, after reading instructions in the help file, I guess it can do many productive things beyond my imagination.

What I want to do is making an expandable comment banner like below, I guess it can be done with regular expression to transform text in a placeholder, but I'm an absolute beginner in writing regular expression...


After a little bit of quick-start lesson, I wrote a short regex, aimed for replacing all characters in a string into "=", which works fine in an online regex tester.


But when I put my regex into a snippets, it behaves totally different, would somebody give me a hand?
dmitryl
Posted on: 3/3/2012 7:48 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: Needs help in writing regex in snippets
ToadLoadin, have you completed this snippet? Wanna to share?
zhouzh2
Posted on: 3/3/2012 8:42 pm
Just can't stay away
Joined: 7/27/2008
From:
Posts: 90
Re: Needs help in writing regex in snippets
// ==${1/./=/g}==
// = ${1:Banner} =
// ==${1/./=/g}==
$0
ToadLoadin
Posted on: 3/3/2012 11:26 pm
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: Needs help in writing regex in snippets
Here it is.

`# Interface.write( document.Config.Highlight.LineComment1 );`==${1/.+?/=/g}==
`# Interface.write( document.Config.Highlight.LineComment1 );`= ${1:Your comment goes here.} =
`# Interface.write( document.Config.Highlight.LineComment1 );`==${1/.+?/=/g}==
$0
dmitryl
Posted on: 3/3/2012 11:58 pm
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: Needs help in writing regex in snippets
Thanks!
dmitryl
Posted on: 3/4/2012 12:02 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: Needs help in writing regex in snippets
ToadLoadin,

How did you do so amazing animation in your post on the thread?

Wanna share as well?

Thank you!
ToadLoadin
Posted on: 3/4/2012 2:33 am
Just can't stay away
Joined: 7/4/2008
From: China
Posts: 119
Re: Needs help in writing regex in snippets
It's just some animated gif images, stored in my Dropbox cloud space.

You can record your action via many screen record software, free ones like AutoScreenRecorder is fine, commercial ones like Camtasia studio is better, but expensive.

After saving my screencast as avi file, I convert it to animated gif image via Format Factory.

Then, put gif image in the "Public" folder of your Dropbox, right click and you will get the direct link which you could use in the forum.

Because of my poor English, I use these animated screencasts to help me explain ideas or problems.
dmitryl
Posted on: 3/4/2012 3:06 am
Just can't stay away
Joined: 12/25/2009
From:
Posts: 73
Re: Needs help in writing regex in snippets
Thank you ToadLoadin! Your English is just fine! But you are right - one picture is better than 1000 words
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文