Jump to content

Kyan

Active Members
  • Posts

    543
  • Joined

  • Last visited

Recent Profile Visitors

637 profile views

Kyan's Achievements

  1. When you're inside another loop than the main loop (the one that receives user inputs from your gui) you can't get those inputs, to circumvent that issue you have to use events, what I usually do is this: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Flag = 1 #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("TEST", 202, 65, 192, 124) $Button1 = GUICtrlCreateButton("Button", 64, 32, 75, 25) $Checkbox1 = GUICtrlCreateCheckbox("OnEvent", 120, 8, 65, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 If GUICtrlRead($Checkbox1) = $GUI_CHECKED And $Flag Then LOOP() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(64,"MSG","NORMAL") EndSwitch WEnd Func LOOP() $Flag = 0 Opt("GUIOnEventMode",1) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") GUICtrlSetOnEvent($Button1,"Button1") GUICtrlSetOnEvent($Checkbox1,"checkbox") While 1 Sleep(20) If $Flag Then ExitLoop WEnd Opt("GUIOnEventMode",0) EndFunc Func Button1() MsgBox(64,"MSG","I'm inside a LOOP") EndFunc Func _exit() Exit EndFunc Func checkbox() $Flag = 1 EndFunc
  2. Is the requested data splited in parts, you just have to merge them. https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
  3. Hi, I'm trying to get the language tags (pt_pt, en_gb,...) and their data "ALLWORK" in this case, why isn't it working? $aPreDATA = '<div data-type="inputText" name="title" data-multilang data-legend="Título" data-force><pt_pt>ALLWORK</pt_pt><en_gb>ALLWORK</en_gb><fr_fr>ALLWORK</fr_fr><de_de>ALLWORK</de_de></div>' $atitle = StringRegExp($aPreDATA,'(?i)<div data-type="inputText" name="title".*?>(?:<(\w{2}_\w{2})>(.+?)</\g-1>)+?</div>',3) _ArrayDisplay($atitle) Also tried this and no luck $aPreDATA = '<div data-type="inputText" name="title" data-multilang data-legend="Título" data-force><pt_pt>ALLWORK</pt_pt><en_gb>ALLWORK</en_gb><fr_fr>ALLWORK</fr_fr><de_de>ALLWORK</de_de></div>' $atitle0 = StringRegExp($aPreDATA,'(?i)<div data-type="inputText" name="title".*?>(.+?)</div>',3) $atitle = StringRegExp($atitle0,'(?i)<(\w{2}_\w{2})>(.*?)</',3) Thanks in advance
  4. Expected Match: ISO/IEC 11770-2:2008/Cor.1:2009(E) Expected Output: ISO/IEC 11770-2:2009(E) #1 GlobalMatch Mode: (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]+)(.+:)?(\d{4}(?:\(\w\))?) output: #2 On global match (3), greedy match: (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]+)(.*:)?(\d{4}(?:\(\w\))?) Same regexp PHP match (2): Row|Col 0 [0]|ISO/IEC 11770-2:2008 [1]|ISO/IEC 11770-2 [2]|: [3]|2008 The thing is that it never outputs the same number of rows. The only possibility I see is to use to output: $a[ubound($a)-3]&$a[ubound($a)-1] to always output the "Expected Output". #1 and #2 end up with the same matches (using in the first the "+" and in the last "*") The things change when I only use "*": (?i)((?:bs )?(?:en )?(?:np )?(?:is[o0]|DIN)\V{1,10}[-\d]*)(.*:)?(\d{4}(?:\(\w\))?) Global Matches (3): PHP Match:
  5. so using .* would only match the last one? (I thought that quantifier matches 0 or more times)
  6. @jchd, there's some way that I start matching from the end of the document?
  7. thank you @jchd! I made it to match other standards than ISO (DIN) and the letter between parenthesis isn't always a (E), that's a revision letter, so I placed a \w instead of "e" https://regex101.com/r/jezYus/3
  8. First of all, thanks to all of you for helping me out. @jchd wow, great website, so your proposal is to match them in groups then use StringRegExpReplace to place them correctly? Can you give me a advice how should I include other standards variants in the first capture group? There're BS EN ISO... EN ISO.., EN NP ISO...and sometimes my OCR fails and translates ISO to IS0 so I tried with this but doesn't look good: ((?:BS\h+)?(?:EN\h+)?(?:NP\h+)?IS[0o]) @InunoTaishou don't be confused, because that's a correct input-output
  9. yes, but that changes how I was capturing strings previously, I was outputting one liners with these (using StringRegExp flag 2): BS( EN ISO)?.+?[\d-]+:[\d-]+(\(\w\))?|DIN.+?[\d-]+:[\d-]+(\(\w\))?|EN\s+?NP\s+?ISO.+?[\d-]+?:[\d-]+(\(\w\))?|EN\s+?ISO.+?[\d-]+:[\d-]+(\(\w\))?|ISO.+?[\d-]+:[\d-]+(\(\w\))? the thing is that I found those "Amd..." that I only wanted the year preceeded by "Amd.\d:" Sorry if this is kinda complicated, but it's kinda hard to understand how a non capturing group is captured.
  10. With stringregexpreplace works fine, but why can't (?:) work properly? $text="ISO 11784:1996/Amd.2:2010(E)|ISO 11784:1996/Amd.1:2007|ISO 11784-1-2:1989(B)" $aText = StringSplit($text,"|") For $x In $aText $l = StringRegExp($x,'(?i)iso\s+\d+:(?:\d{4}.+?amd.+?\:)\d{4}(?:\(\w\))?',2) If Not @error Then ConsoleWrite($l[0]&@LF) Next outputs: ISO 11784:1996/Amd.2:2010(E) ISO 11784:1996/Amd.1:2007 EDIT: This one also doesn't work, is a zero width look behind $text="ISO 11784:1996/Amd.2:2010(E)|ISO 11784:1996/Amd.1:2007|ISO 11784-1-2:1989(B)" $aText = StringSplit($text,"|") For $x In $aText $l = StringRegExp($x,'(?i)iso\s+[-\d]+:(?<=\d{4}.+?amd.+?\:)?\d{4}(?:\(\w\))?',2) If Not @error Then ConsoleWrite($l[0]&@LF) Next @Melba23 I need your expertise pls
  11. Already said what they are but there it goes an example Inputs: ISO 11784:1996/Amd.2:2010(E) ISO 11784:1996/Amd.1:2007 ISO 11784-1-2:1989(B) Outputs: ISO 11784:2010(E) ISO 11784:2007 ISO 11784-1-2:1989(B)
  12. Hey mikell Can't be done with the regular expression? I could do that, I do that to remove multiple consecutive spaces after capturing it (?i)iso\s+\d+:(?:\d{4}.+amd.+:)?\d{4}(?:\(e\))? This one also doesn't work, it displays 1996
  13. Hi jchd, It doesn't work, outputs: Row|Col 0 [0]|ISO 11784:1996(E) [1]|ISO 11784: [2]| [3]|1996(E) on the line [0] should have outputted: ISO 11784:2010(E) there's also standards with hyphens: ISO 11412-2-1:2001, that's why I used a class
  14. Hey everyone I'm stuck with this regular expression, for matching a iso standard version what I want to do is match the text in green: ISO 11784:1996/Amd.2:2010(E) there is also others that look like this: ISO 11789:1999(E), and without the (E) part, Só I did this one  (?i)ISO.+?[\d-]+:(?:\d+/Amd.+?:)?[\d-]+(?:\(\w\))* to match both cases but doesn't ignore the text in red Can somebody point out what I'm doing wrong here?
×
×
  • Create New...