cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-595782%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595782%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CSPAN%3EEs%20kann%20diese%20fortgeschrittenen%20Techniken%20nicht%20in%20einem%20Skriptleitfaden%20lernen.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595788%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595788%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDanke!%3C%2FP%3E%0A%3CP%3EEs%20ist%20schwierig%2C%20gute%20Beispiele%20f%C3%BCr%20einige%20Funktionen%20in%20Regex%20zu%20machen.%20Dies%20ist%20ein%20gutes%20Beispiel%20f%C3%BCr%20Lookaround.%20Ich%20denke%2C%20ich%20k%C3%B6nnte%20es%20ohne%20Lookaround%20tun%2C%20aber%20es%20w%C3%A4re%20komplizierter.%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4160%22%20target%3D%22_blank%22%3E%40shannon_conners%3C%2FA%3E%20F%C3%BCr%20das%20Doc-Team%3A%20Die%20gemeinsame%20Verwendung%20von%20Positiv%20und%20Negativ%2C%20Vorne%20und%20Hinten%20macht%20dies%20kompakt%20und%20ausdrucksstark%20(mit%20einem%20Kommentar).%20Es%20ist%20eine%20ungew%C3%B6hnliche%20Situation%2C%20kein%20Mainstream-Gebrauch.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595811%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595811%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDanke%20Craige!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIch%20m%C3%B6chte%20Ihnen%20eine%20Frage%20zur%20zugrunde%20liegenden%20Anwendung%20stellen%3A%3CBR%20%2F%3E%20Ich%20m%C3%B6chte%20JSL%20verwenden%2C%20um%20mehr%20Nutzung%20zu%20l%C3%B6sen%2C%20kann%20Python%20und%20andere%20Tools%20nicht%20verwenden.%3CBR%20%2F%3E%20Nat%C3%BCrlich%20habe%20ich%20den%20gesamten%20JSL-Code%20von%20den%20vielen%20Experten%20in%20dieser%20Community%20gelernt.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EMeine%20Bitte%20lautet%20konkret%3A%3C%2FP%3E%3CP%3Ewie%20man%20Protobuf%20(Google%20Protocol%20Buffe)-formatierten%20Bin%C3%A4rtext%20in%20JMP-Text%20%C3%BCber%20JSL%20wiederherstellt.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595816%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595816%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3EWie%20k%C3%B6nnen%20Sie%20JSL%20wie%20C%23-Code-Codierungscode%20%C3%A4ndern%3F%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%2220230201205422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F49692i78BF7F90D2A87013%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%2220230201205422.png%22%20alt%3D%2220230201205422.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3EEs%20ist%20mir%20nicht%20gelungen%2C%20es%20umzuschreiben.%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3EDanke!%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Eh%20%3D%20%5B%3D%26gt%3B%20%5D%3B%0Au%20%3D%20%22http%3A%2F%2Fds.m.emoney.cn%2Fpick%22%3B%0Ah%5B%22X-Protocol-Id%22%5D%20%3D%20%228900%22%3B%0Ah%5B%22X-Request-Id%22%5D%20%3D%20%22null%22%3B%0A%0Ab%20%3D%20Char%20To%20Blob(%20%22~0A~0D~E5~BD~93~E6~97~A5~42~E7~82~B9~E8~82~A1~10~F2~DF~D2~09%22%2C%20%22ascii~hex%22%20)%3B%0Ars%20%3D%20New%20HTTP%20Request(%20URL(%20u%20)%2C%20Method(%20%22POST%22%20)%2C%20JSON(%20b%20)%2C%20Headers(%20h%20)%20)%3B%0Arr%20%3D%20rs%20%26lt%3B%26lt%3B%20Send%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595818%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595818%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3EDies%20ist%20nur%20die%20allgemeine%20Gliederung.%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CUL%3E%3CLI%3E%3CP%20class%3D%22%22%3EDas%20Hauptproblem%20besteht%20darin%2C%20zu%20l%C3%B6sen%2C%20wie%20Anforderungsparameter%20korrekt%20in%20JSL%20geschrieben%20werden.%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595825%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595825%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EInteressant%3CA%20href%3D%22https%3A%2F%2Fdevelopers.google.com%2Fprotocol-buffers%2Fdocs%2Foverview%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fdevelopers.google.com%2Fprotocol-buffers%2Fdocs%2Foverview%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EEs%20sieht%20so%20aus%2C%20als%20h%C3%A4tten%20Sie%20zwei%20M%C3%B6glichkeiten%3A%20Schreiben%20Sie%20Ihre%20eigene%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fprotocolbuffers%2Fprotobuf%2Fblob%2Fmaster%2Fdocs%2Fthird_party.md%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fgithub.com%2Fprotocolbuffers%2Fprotobuf%2Fblob%2Fmaster%2Fdocs%2Fthird_party.md%3C%2FA%3E%20was%20dann%20f%C3%BCr%20viele%20Protokolle%20funktionieren%20w%C3%BCrde%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eoder%2C%20leichter%20und%20schwerer%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EW%C3%A4hlen%20Sie%20eine%20vorhandene%20aus%20und%20%C3%BCbersetzen%20Sie%20sie.%20Ich%20habe%20es%20mir%20nicht%20angesehen%2C%20aber%20ich%20k%C3%B6nnte%20versuchen%2C%20mit%20einer%20JAVA-Version%20zu%20beginnen%20und%20diese%20in%20JSL%20zu%20%C3%BCbersetzen.%20Aber%20dann%20m%C3%BCssen%20Sie%20die%20%C3%9Cbersetzung%20f%C3%BCr%20das%20n%C3%A4chste%20Protokoll%20wiederholen.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEs%20w%C3%A4re%20ein%20ziemlich%20cooles%20Projekt%2C%20einen%20%C3%9Cbersetzer%20zu%20machen.%20Das%20habe%20ich%20nicht%20vor.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595837%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595837%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EVielen%20Dank%2C%20Craige!%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EIch%20wei%C3%9F%2C%20dass%20es%20ein%20sehr%20schwieriger%20Job%20ist.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20Vielen%20Dank%2C%20dass%20Sie%20einen%20allgemeinen%20Rahmen%20geschrieben%20haben.%20Ich%20werde%20versuchen%2C%20mehr%20Wissen%20zum%20%C3%84ndern%20zu%20erlernen.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20Danke%20dir%20f%C3%BCr%20deine%20Bem%C3%BChungen.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595485%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595485%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVerwenden%20Sie%20zwei%20Anweisungen.%20Ich%20habe%20Ihrem%20Beispiel%20einige%20zus%C3%A4tzliche%20Problemzeichen%20hinzugef%C3%BCgt%20...%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Etxt%20%3D%20%22d%E8%AF%951(-%E6%98%AF2%5E3(%5Ba%5D%E6%96%87%2F%E5%AD%97789(%2B%E5%86%85%5Cc%E5%AE%B94%243%22%3B%0Astep1%20%3D%20Regex(%20txt%2C%20%22%5C(%22%2C%20%22%5C!n%22%2C%20globalreplace%20)%3B%0Astep2%20%3D%20Regex(%20step1%2C%20%22%5B-%2B%2F%5C%5C%5E%24%5B%5C%5Da-zA-Z%5D%22%2C%20%22%22%2C%20globalreplace%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3C%2FCODE%3EDas%20(%20muss%20f%C3%BCr%20Schritt%201%20mit%20Regex-Escapezeichen%20versehen%20werden.%20Der%20Zeilenumbruch%20ist%20JSL-escaped.%3C%2FP%3E%0A%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%3C%2FCODE%3EF%C3%BCr%20Schritt%202%20ist%20die%20Syntax%20von%20%5B...%5D%20kompliziert%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EBeginnen%20Sie%20mit%20dem%20-%20denn%20ohne%20ein%20f%C3%BChrendes%20Zeichen%20kann%20es%20kein%20Bereich%20wie%20az%20sein.%20(Andernfalls%20ist%20ein%20Regex-Escape%20erforderlich%2C%20%5C-%20)%3C%2FLI%3E%0A%3CLI%3EDas%20%5C%20muss%20mit%20einem%20regul%C3%A4ren%20Ausdruck%20maskiert%20werden%3C%2FLI%3E%0A%3CLI%3EDas%20%5D%20muss%20mit%20einem%20Regex-Escapezeichen%20versehen%20werden%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAchten%20Sie%20darauf%2C%20nicht%20versehentlich%20den%20JSL-Escape%20%5C%5B%20zu%20schreiben%2C%20der%20die%20Art%20und%20Weise%20%C3%A4ndert%2C%20wie%20JSL%20Strings%20interpretiert.%20Dies%20kann%20bei%20der%20Arbeit%20mit%20Zeichens%C3%A4tzen%20in%20%5B...%5D%20passieren%2C%20wenn%20Sie%20nicht%20wissen%2C%20dass%20es%20ein%20Problem%20sein%20wird.%3C%2FP%3E%0A%3CP%3EBeachten%20Sie%20die%20Reihenfolge%20%5B%5C%5D.%20Es%20handelt%20sich%20nicht%20um%20einen%20Zeichensatz.Es%20handelt%20sich%20um%202%20Zeichen%2C%20die%20in%20einem%20Zeichensatz%20enthalten%20sind.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595432%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EWie%20verwende%20ich%20die%20Regex-Substitution%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595432%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EErsetzt%20das%20angegebene%20%E2%80%9E(%E2%80%9C%20durch%20ein%20Zeilenumbruchzeichen%20und%20entfernt%20alle%20nicht-chinesischen%20und%20nicht%20numerischen%20Zeichen.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Ed%E8%AF%951(-%E6%98%AF23(a%E6%96%87%E5%AD%97789(%2B%E5%86%85c%E5%AE%B94%243%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-01-31_20-13-35.png%22%20style%3D%22width%3A%20161px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F49669iDC716C5249468CDF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222023-01-31_20-13-35.png%22%20alt%3D%222023-01-31_20-13-35.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Etxt%3D%22d%E8%AF%951(-%E6%98%AF23(a%E6%96%87%E5%AD%97789(%2B%E5%86%85c%E5%AE%B94%243%22%3B%0A%0Ana%3DRegex(txt%2C%20%20%EF%BC%9F%EF%BC%9F%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CCODE%20class%3D%22%20language-jsl%22%3EDanke!%3C%2FCODE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-595432%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EErweiterte%20statistische%20Modellierung%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595650%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EBetreff%3A%20Wie%20verwende%20ich%20die%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595650%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EDanke%2C%20Craige!%3C%2FP%3E%3CP%3E%3CSPAN%3EIch%20verwende%20zum%20Ersetzen%20einfach%20EmEditor%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20Wie%20verwende%20ich%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CBR%20%2F%3EDanke%2C%20Craige!%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3EWenn%20ich%20diese%20Ersetzung%20noch%20einen%20Schritt%20weiterf%C3%BChren%20m%C3%B6chte%3A%20F%C3%BCge%20zwischen%20den%20chinesischen%20Schriftzeichen%20und%20den%20Daten%20Tabulatoren%20ein%20(setze%20die%20chinesischen%20Schriftzeichen%20im%20Originaltext%20nach%20links%20und%20die%20Zahlen%20nach%20rechts)%2C%20um%20eine%20Tabelle%20zu%20erhalten%2C%20die%20das%20Ergebnis%20der%20Ersetzung%20direkt%20in%20JMP%20eingeben%20kann%3A%3CBR%20%2F%3E%20Wie%20muss%20der%20Code%20ge%C3%A4ndert%20werden%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222023-02-01_17-58-10.png%22%20style%3D%22width%3A%20158px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-02-01_17-58-10.png%22%20style%3D%22width%3A%20158px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-02-01_17-58-10.png%22%20style%3D%22width%3A%20158px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222023-02-01_17-58-10.png%22%20style%3D%22width%3A%20158px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F49688i14C07D3E234FDDFE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222023-02-01_17-58-10.png%22%20alt%3D%222023-02-01_17-58-10.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Etxt%20%3D%20%22d%E8%AF%951(-%E6%98%AF2%5E3(%5Ba%5D%E6%96%87%2F%E5%AD%97789(%2B%E5%86%85%5Cc%E5%AE%B94%243%22%3B%0Astep1%20%3D%20Regex(%20txt%2C%20%22%5C(%22%2C%20%22%5C!n%22%2C%20globalreplace%20)%3B%2F%2F%EF%BC%9F%EF%BC%9F%0Astep2%20%3D%20Regex(%20step1%2C%20%22%5B-%2B%2F%5C%5C%5E%24%5B%5C%5Da-zA-Z%5D%22%2C%20%22%22%2C%20globalreplace%20)%3B%2F%2F%EF%BC%9F%EF%BC%9F%0A%0As%20%3D%20N%20Items(%20step2%20)%3B%0Adt%20%3D%20New%20Table(%20%22A%22%2C%20Add%20Rows(%20s%20)%2C%20New%20Column(%20%22txt%22%2C%20Character%2C%20%22Nominal%22%20)%2C%20New%20Column(%20%22num%22%20)%20)%3B%0Adt%5B0%2C%200%5D%20%3D%20step2%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595780%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20Wie%20verwende%20ich%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595780%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDies%20ist%20ein%20Beispiel%20f%C3%BCr%20einen%20negativen%20Blick%20nach%20hinten%20und%20einen%20positiven%20Blick%20nach%20vorn%2C%20%3CA%20href%3D%22https%3A%2F%2Fwww.regular-expressions.info%2Flookaround.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Elookaround%3C%2FA%3E%20.%20Schritt%203%20verwendet%20beides.%3C%2FP%3E%0A%3CPRE%3E(%3F%3C!--%5Cd)%3C%2FPRE--%3E%0A%3CP%3Epasst%20zu%20einem%20einzelnen%20Zeichen%2C%20das%20%3CEM%3Ekeine%3C%2FEM%3E%20Ziffer%20ist%2C%20direkt%20%3CEM%3Evor%3C%2FEM%3E%20der%20aktuellen%20Position%20mit%20der%20L%C3%A4nge%20Null.%3C%2FP%3E%0A%3CPRE%3E(%3F%3D%5Cd)%3C%2FPRE%3E%0A%3CP%3Epasst%20zu%20einem%20einzelnen%20Zeichen%2C%20das%20eine%20Ziffer%20direkt%20%3CEM%3Enach%3C%2FEM%3E%20der%20aktuellen%20Position%20mit%20der%20L%C3%A4nge%20Null%20%3CEM%3Eist%3C%2FEM%3E%20.%3C%2FP%3E%0A%3CP%3EDas%20Tabulatorzeichen%20wird%20in%20die%20Position%20mit%20der%20L%C3%A4nge%20Null%20eingef%C3%BCgt%2C%20um%20die%20Nicht-Ziffer%20von%20der%20Ziffer%20zu%20trennen.%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Etxt%20%3D%20%22d%E8%AF%951(-%E6%98%AF2%5E3(%5Ba%5D%E6%96%87%2F%E5%AD%97789(%2B%E5%86%85%5Cc%E5%AE%B94%243%22%3B%0A%2F%2F%20change%20paren%20to%20newline...%0Astep1%20%3D%20Regex(%20txt%2C%20%22%5C(%22%2C%20%22%5C!n%22%2C%20globalreplace%20)%3B%0A%2F%2F%20remove%20unwanted%20characters%20-%20%2B%20%2F%20%5C%20%5E%20%24%20%5B%20%5D%20a..z%20A..Z%0Astep2%20%3D%20Regex(%20step1%2C%20%22%5B-%2B%2F%5C%5C%5E%24%5B%5C%5Da-zA-Z%5D%22%2C%20%22%22%2C%20globalreplace%20)%3B%0A%2F%2F%20insert%20tab%20when%20character%20before%20is%20not%20a%20digit%20and%20character%20after%20is%20a%20digit%0Astep3%20%3D%20Regex(%20step2%2C%20%22(%3F%3C!--%5Cd)(%3F%3D%5Cd)%22%2C%20%22%5C!t%22%2C%20globalreplace%20)%3B%0A%2F%2F%20add%20header%0Astep4%20%3D%20%22aaa%5C!tbbb%5C!n%22%20%7C%7C%20step3%3B%0A%2F%2F%20import%20the%20string%20without%20making%20a%20file%20on%20disk%0AOpen(%20Char%20To%20Blob(%20step4%20)%2C%20%22text%22%20)%3B%3C%2FCODE--%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22tabs%20separate%20fields%22%20style%3D%22width%3A%20222px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22tabs%20separate%20fields%22%20style%3D%22width%3A%20222px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22tabs%20separate%20fields%22%20style%3D%22width%3A%20222px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F49689i961EE5E9BA544965%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture.PNG%22%20alt%3D%22tabs%20separate%20fields%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Etabs%20separate%20fields%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3Etabs%20separate%20fields%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ETabulatoren%20trennen%20Felder%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-595781%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBetreff%3A%20Wie%20verwende%20ich%20Regex-Ersetzung%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-595781%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EDanke%20Craig!%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESchauen%20Sie%20sich%20den%20Code%20an%2C%20den%20Sie%20schreiben%2C%20es%20macht%20wirklich%20Spa%C3%9F!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
lala
Level IX

How do I use Regex substitution?

Replaces the specified "(" with a newline character and removes all non-Chinese and non-numeric characters.

 

d试1(-是23(a文字789(+内c容4$3

2023-01-31_20-13-35.png

txt="d试1(-是23(a文字789(+内c容4$3";

na=Regex(txt,  ?? );

 Thanks!

12 REPLIES 12
Craige_Hales
Super User

Re: How do I use Regex substitution?

use two statements. I added some extra problem characters to your example...

txt = "d试1(-是2^3([a]文/字789(+内\c容4$3";
step1 = Regex( txt, "\(", "\!n", globalreplace );
step2 = Regex( step1, "[-+/\\^$[\]a-zA-Z]", "", globalreplace );

The ( needs to be regex-escaped for step1. The newline is JSL-escaped.

For step2, the syntax of the [...] is complicated:

  • start with the - because without a leading character it can't be a range like a-z. (Otherwise it needs a regex-escape, \- )
  • the \ needs to be regex-escaped
  • the ] needs to be regex-escaped

Be careful not to accidentally write the JSL-escape \[ which changes the way JSL interprets strings. This is likely to happen when working with character sets in [...] if you don't know it will be a problem.

Notice the sequence [\]. It is not a character set.  It is 2 characters that are in a character set.

Craige
lala
Level IX

Re: How do I use Regex substitution?

Thank Craige!

I'll just use EmEditor to re replace

lala
Level IX

Re: How do I use Regex substitution?


Thank Craige!

 

If I want to take this re substitution one step further: insert tabs between the Chinese characters and the data (set the Chinese characters in the original text to the left and the numbers to the right), to achieve a table that can input the result of the substitution directly into the JMP:
How do you need to change the code?

2023-02-01_17-58-10.png

 

txt = "d试1(-是2^3([a]文/字789(+内\c容4$3";
step1 = Regex( txt, "\(", "\!n", globalreplace );//??
step2 = Regex( step1, "[-+/\\^$[\]a-zA-Z]", "", globalreplace );//??

s = N Items( step2 );
dt = New Table( "A", Add Rows( s ), New Column( "txt", Character, "Nominal" ), New Column( "num" ) );
dt[0, 0] = step2;

 

Craige_Hales
Super User

Re: How do I use Regex substitution?

This is an example for negative look behind and positive look ahead, lookaround. Step 3 is using both.

(?<!\d)

matches a single character that is not a digit just before the current zero-length position.

(?=\d)

matches a single character that is a digit just after the current zero-length position.

The tab character is inserted into the zero-length position to separate the non-digit from the digit.

 

txt = "d试1(-是2^3([a]文/字789(+内\c容4$3";
// change paren to newline...
step1 = Regex( txt, "\(", "\!n", globalreplace );
// remove unwanted characters - + / \ ^ $ [ ] a..z A..Z
step2 = Regex( step1, "[-+/\\^$[\]a-zA-Z]", "", globalreplace );
// insert tab when character before is not a digit and character after is a digit
step3 = Regex( step2, "(?<!\d)(?=\d)", "\!t", globalreplace );
// add header
step4 = "aaa\!tbbb\!n" || step3;
// import the string without making a file on disk
Open( Char To Blob( step4 ), "text" );

tabs separate fieldstabs separate fields

Craige
lala
Level IX

Re: How do I use Regex substitution?

Thank Craige!


Look at the code you write, a real enjoyment!

lala
Level IX

Re: How do I use Regex substitution?

It can't learn these advanced techniques in a script guide.

Craige_Hales
Super User

Re: How do I use Regex substitution?

Thanks!

It is hard to make good examples for some features in regex. This is a good example for lookaround. I think I could do it without lookaround, but it would be more complicated. @shannon_conners for the doc team: using positive and negative, ahead and behind, together, is what makes this compact and expressive (with a comment). It is an unusual situation, not mainstream usage.

 

Craige
lala
Level IX

Re: How do I use Regex substitution?

Thank Craige!

 

I'd like to ask you a question about the underlying application:
I want to use JSL to solve more usage, can not use python and other tools.
Of course, I learned all of the JSL code from the many experts in this community.


My request is specifically:

how to restore protobuf(Google Protocol Buffe)-formatted binary text to JMP text ues JSL.

Craige_Hales
Super User

Re: How do I use Regex substitution?

Interesting https://developers.google.com/protocol-buffers/docs/overview

It looks like you have two choices: write your own https://github.com/protocolbuffers/protobuf/blob/master/docs/third_party.md which would then work for many protocols,

 

or, easier and harder,

 

pick an existing one and translate. I have not looked at it, but I might try starting with a JAVA version and translate that to JSL. But then you get to repeat the translation for the next protocol.

 

It would be a pretty cool project to make a translator. I do not plan to do that.

Craige

Recommended Articles