- AuthorPosts
- October 31, 2008 at 7:15 pm #6516nickbMember
Hello,
I downloaded the script from http://www.emeditor.com/modules/mydownloads/singlefile.php?cid=8&lid=169 and when using it I noticed that it treats lower cases and capital letters different.
example:
If you have a list…
hello
Hello
heLLoYou use the script to extract ‘hello’, you will only get the ‘hello’ with the lower cases.
How can I change this so the script treats all letters equal?
if( !editor.EnableTab ){
editor.EnableTab = true;
alert( "Please run this macro again." );
Quit();
}
sFind = prompt( "This macro extracts lines that do contain the specified string:", "" );
if( sFind == "" ){
Quit();
}
Redraw = false;
docSearch = editor.ActiveDocument;
editor.NewFile();
docResult = editor.ActiveDocument;
docSearch.Activate();
docSearch.selection.StartOfDocument();
y = 1;
do {
docSearch.selection.SetActivePoint( eePosLogical, 1, y );
if( y != docSearch.selection.GetActivePointY( eePosLogical ) ) break;
docSearch.selection.SelectLine();
sLine = docSearch.selection.Text;
re = new RegExp( ".*" + sFind + ".*" );
result = re.test( sLine );
if( result ){
docResult.Activate();
docResult.selection.Text = sLine;
}
docSearch.Activate();
y++;
} while( true );
thanks!
November 1, 2008 at 6:57 pm #6524dreftymacParticipantHello nickb,
Try taking the line that says:
re = new RegExp( “.*” + sFind + “.*” );
… and change it to this …
re = new RegExp( “.*” + sFind + “.*” , “i”);
This should tell the regular expression matcher to ignore case.
For more details see :
http://www.regular-expressions.info/javascript.html
or search microsoft.com for “jscript reference” “regexp”HTH
November 1, 2008 at 11:11 pm #6526nickbMemberThanks, dreftymac ! Now it works. :-)
- AuthorPosts
- You must be logged in to reply to this topic.