10 posts in this topic
I want to rename every new instance of notepad to notepad(random number)
If I use WinSetTitle ( "notepad", "", "notepad("&$randomnumber&")" )
this will work pretty good, because if more windows match the search entry it will take the newest. But what if this code runs, but there is no new instance of notepad. It will rename one that was already assigned a number. So I would like to check whether it is already renamed. For example by excluding titles that contain a ")".
How do I do that.
Read this, but that is pretty confusing: http://stackoverflow.com/questions/406230/regular-expression-to-match-line-that-doesnt-contain-a-word?rq=1
#include <Array.au3> ; Script Start - Add your code below here Local $test = "<li>One<li>Inner<li>Innermost</li></li></li>" & _ "<li>Two</li> " $loob = StringRegExp($test, '\Q<li>\E(.*?)\Q</li>\E', 3) _ArrayDisplay($loob, "How to return the One... and Two?") Hello, can somebody help me:
(1) How can I have the regexp matched the two outermost bullets? Such that:
(2) How can I match the "Innermost" bullet?
Thanks so much.
#include <Array.au3> If @Compiled Then Exit Global Enum $FUNC_OUTER, $FUNC_NAME, $FUNC_PARAM, $FUNC_INNER _Example() Func _Example() Local $sIncludeDir = StringTrimRight(@AutoItExe, StringLen('AutoIt3.exe')) & 'Include\' Local $aOuterArray = _GetFunctionsToArray($sIncludeDir & 'Color.au3') If Not @error Then For $iOuter_idx = 0 To UBound($aOuterArray) - 1 _ArrayDisplay($aOuterArray[$iOuter_idx], ($aOuterArray[$iOuter_idx])[$FUNC_NAME]) Next EndIf EndFunc ;==>_Example Func _GetFunctionsToArray($sUDF_FileFullPath) Local $sUDFContent = FileRead($sUDF_FileFullPath) Local $aResult = StringRegExp($sUDFContent, '(?is)\RFunc (.*?)\((.*?)\)\v\R(.*?)\REndFunc', $STR_REGEXPARRAYGLOBALFULLMATCH) Return SetError(@error, @extended, $aResult) EndFunc ;==>_GetFunctionsToArray
I am trying to create a regExp for following HTML text:
<a href="link=1">1</a> <b>2</b> <a href="link=3">3</a> | <a href="link=2">Previous</a> | <a href="link=3">Next</a> My intention is to extract href from last <a> tag.
Here is my attempt:
Local $reg = '(?i)\|\s?<a href="(.*?)">Next</a>' Local $text = '<a href="link=1">1</a> <b>2</b> <a href="link=3">3</a> | <a href="link=2">Previous</a> | <a href="link=3">Next</a>' $aData = StringRegExp($text,$reg,3) ConsoleWrite($aData&@LF) Now problem is i am unable to extract exact href from the last <a> tag.
Here is the output:
link=2">Previous</a> | <a href="link=3 I know I can use other techniques, but i want to know, why my pattern is not working or what is the right pattern for such situation?
Thanks in Advance.
I want to capitalize 1st word of every sentence with StringRegExp, I am able to collect words by using this pattern:
Local $reg = '(?:^|(?:[.!?]\s))(\w+)' now my problem is how can I exactly replace these words, e.g. In the following string:
I only want to replace 1st "the" of the sentence with "The" but I have only words in array from RegExp, without its position in string.