grham Posted January 8, 2008 Posted January 8, 2008 (edited) Hello, maybe I don't see anything or I'm doing something wrong? This is a pattern that matches - correctly - a comma (,) in a string before a non white space character. $Res = StringRegExp($String, '(,)(?:\H)', 3) Non obstant I can't use the same pattern for StringRegExpReplace: (HelpFile?) This matches the comma (,) and "non capturing (?:\H)" (both of them) $String = StringRegExpReplace($String, '(,)(?:\H)', ', ', 0) I imagine a workaround to accomplish my goal (would not be so hard) (replace all commas only before a non white space character with a comma + white space) but could someone tell me, please, if it's a feature of StringRegExpReplace because I didn't find anything "on the topic"? Than you. Edited January 8, 2008 by grham
Xenobiologist Posted January 8, 2008 Posted January 8, 2008 (edited) Hi, sorry I don't get it. Which text did you try it on? So long, Mega Edited January 8, 2008 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
grham Posted January 8, 2008 Author Posted January 8, 2008 (edited) Hi,sorry I don't get it. Which text did you try it on?So long,MegaFor example:$String = "Montag,Dienstag,Mittwoch, Donnerstag,Freitag,Samstag,Sonntag"Try to put a whitespace after any comma with my "example" so that you don't gettwo whitespaces between Mittwoch and Donnerstag. Not: ..., Mittwoch, 'white' 'white' Donnerstag, ..."==> "Montag, Dienstag, M ...."I know it can be done in a different way. Edited January 8, 2008 by grham
Siao Posted January 8, 2008 Posted January 8, 2008 Use normal group with backref then: StringRegExpReplace($String, '(,)(\H)', ', \2', 0) "be smart, drink your wine"
Xenobiologist Posted January 8, 2008 Posted January 8, 2008 Hi, meinst du nicht #include<Array.au3> $String = "Montag,Dienstag,Mittwoch, Donnerstag,Freitag,Samstag,Sonntag" $String = StringRegExpReplace($String, '(,)(?=\H)', ', ') ConsoleWrite($String & @CRLF) So long, Mega P.S.: Habe Samstag mal mit einem m geschrieben. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
grham Posted January 8, 2008 Author Posted January 8, 2008 (edited) Use normal group with backref then:StringRegExpReplace($String, '(,)(\H)', ', \2', 0)OK, I got itThis works exactly as expected("lack" in my knowledge)Siao: Thank you!Mega: Ooops (btw., ich bin nicht deutsch, Ich kenne Dich nur aus dem deutschen Forum, spreche ein bisschen Deutsch) Danke für "Samstag"!!!!! Edited January 8, 2008 by grham
Xenobiologist Posted January 8, 2008 Posted January 8, 2008 Hi, okay. Youg got $String = "Montag,Dienstag,Mittwoch, Donnerstag,Freitag,Samstag,Sonntag" what should it look like after the StringRegReplace ? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
grham Posted January 8, 2008 Author Posted January 8, 2008 (edited) Hi,okay. Youg got $String = "Montag,Dienstag,Mittwoch, Donnerstag,Freitag,Samstag,Sonntag"what should it look like after the StringRegReplace ?So long,MegaI'm sorry Mega (my fault)your example Works as expected too!!!(Entschuldigung) and Thank you Very much Edited January 8, 2008 by grham
Xenobiologist Posted January 8, 2008 Posted January 8, 2008 I'm sorry Mega (my fault)your example Works as expected too!!!(Entschuldigung) and Thank you Very muchHI, no problem (kein Problem) Hatte mich schon gewundert, was du willst. I already wondered what you want to achieve.Sprichst aber gutes deutsch!So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now