Jump to content
Sign in to follow this  
n9mfk9

RegExp pattern ?

Recommended Posts

Hi all I need some help

With some RegExp pattern I try to use for an other program language but i can not find what wood do the same in autoit

s

Treat string as single line

m

Treat string as multiple lines

g

Global matching, and keep the Current position after failed

thanks beau

Share this post


Link to post
Share on other sites

Hi all I need some help

With some RegExp pattern I try to use for an other program language but i can not find what wood do the same in autoit

s

Treat string as single line

m

Treat string as multiple lines

g

Global matching, and keep the Current position after failed

thanks beau

I'm not sure what you need but there is definitely a subliminal message in there.

s = Sarah

m = Michelle

g = Gellar

Share this post


Link to post
Share on other sites

I'm not sure what you need but there is definitely a subliminal message in there.

s = Sarah

m = Michelle

g = Gellar

no subliminal message in there I am look at a perl program an trying to do it in autoit

Share this post


Link to post
Share on other sites

Hi,

Treat string as single line

By default $ means end of string, so if you use it at the end of the pattern, it will be as one line :)

You can read about AutoIt RegExp methods in the help file (Online Documentations).


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Look in the help file.

#include <String.au3>

_StringBetween ( $sString, $sStart, $sEnd [, $vCase [, $iSRE ]] )

Share this post


Link to post
Share on other sites

hi everyone

is there a way if i have a string of text with %any thing in here% more text her

how can i take just this part out %any thing in here%

thanks beau

Share this post


Link to post
Share on other sites

([%]+(.)+[%])

This will grab whatever is between the %'s, but it also grabs the %'s. I'm an amateur at SRE, so there may be a way to strip the %'s as well.

Example: This line is %used as an& example....

Results: %used as an%

Edited by Fossil Rock

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

here some test code i tried it still leaves out % % thanks for any help

Beau

#include <String.au3>

#include <array.au3>

$file = FileOpen("mylist.txt", 0)

;Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

$aArray1 = _StringBetween($line, '%', '%',-1,'([%]+(.)+[%])')

_ArrayDisplay($aArray1, 'StringRegExp Search')

If Not @error Then

EndIf

WEnd

;FileClose($fileout)

FileClose($file)

Share this post


Link to post
Share on other sites

What do you mean it leaves out % and %? If you need those on the string just append them to the found match.

$var = "%" & $var & "%"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...