Ticket #36405

strreplaceで正しく置換されない_V4.91

Date d'ouverture: 2016-06-20 14:10 Dernière mise à jour: 2016-08-22 20:05

Rapporteur:
(Anonyme)
Propriétaire:
Type:
État:
Atteints
Composant:
Priorité:
5 - moyen
Sévérité:
5 - moyen
Résolution:
Fixed
Fichier:
Aucun
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Détails

strreplaceにて置換処理を行う場合、文字列 [ を正しく置換出来ません。

例:実行マクロ

test = '[test]'
strreplace test 1 '[' 'pre-'
messagebox test ''

結果:

[test]pre↑

Ticket History (3/6 Histories)

2016-06-20 14:10 Updated by: None
  • New Ticket "strreplaceで正しく置換されない_V4.91" created
2016-06-20 14:13 Updated by: None
Commentaire

追記です、動作環境は以下となります。 OS:Windows 7 professional SP1(64bit)

(匿名) への返信

strreplaceにて置換処理を行う場合、文字列 [ を正しく置換出来ません。 例:実行マクロ ------------------------------- test = 'test' strreplace test 1 '[' 'pre-' messagebox test ------------------------------- 結果: ------------------------------- testpre↑ -------------------------------

2016-06-20 15:07 Updated by: doda
  • Details Updated
Commentaire

'[' は正規表現で意味を持つ文字なので、'[' 自体を置き換える場合は適切にエスケープする必要があります。

例:

test = '[test]'
strreplace test 1 '\[' 'pre-'
messagebox test ''
;=> pre-test]

これとは別に、正しく閉じていない正規表現の場合に結果がおかしくなりますね。これは修正します。

2016-06-20 20:19 Updated by: None
Commentaire

失礼しました、ご指摘ありがとうございます。

2016-06-20 20:24 Updated by: doda
  • Jalon Update from (Aucun) to Tera Term 4.92 (atteints)
  • Propriétaire Update from (Aucun) to doda
  • Résolution Update from Aucun to Fixed
2016-08-22 20:05 Updated by: (del#1144)
  • État Update from Ouvert to Atteints
  • Ticket Close date is changed to 2016-08-22 20:05

Attachment File List

No attachments

Modifier

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Connexion