1
A
回答
0
VB的淨嘗試
Dim strCurrentLine as string = "test : abc/gef fhhff/fhrhr krerjr"
If UCase(strCurrentLine.ToString.StartsWith("TEST")) = True Then
strCurrentLine = Replace(strCurrentLine.ToString, " ", "Replace space with this text")
End If
爲C#嘗試
string strCurrentLine = "test : abc/gef fhhff/fhrhr krerjr";
if (Strings.UCase(strCurrentLine.ToString().StartsWith("TEST")) == true) {
strCurrentLine = Strings.Replace(strCurrentLine.ToString(), " ", "Replace space with this text");
}
或去這裏的VB的正則表達式http://visualbasic.about.com/od/usingvbnet/a/RegExNET_2.htm
或去這裏爲C#正則表達式http://oreilly.com/windows/archive/csharp-regular-expressions.html
0
在Perl中,你必須做一些事情,如:
use strict;
use warnings;
use 5.010;
my $text = q|test : "abc/gef fhhff/fhrhr krerjr"|;
#below is the regex that does the replace - \s is for whitespace class
$text =~ s/\s/+/gmix if ($text =~ /^test/gmix);
say "new text: $text";
相關問題
- 1. 如何獲得以下任務
- 2. BackgroundWorker的任務並行庫替換?
- 3. 如何替換Google App Engine任務隊列上的任務?
- 4. 搜索數組以獲得值匹配並替換值 - php
- 5. 如何替換任何Linq
- 6. 如何獲得一個scala宏以替換方法調用
- 7. 如何獲得任務優先級
- 8. 如何獲得任務完成/完成?
- 9. 如何獲得有關多任務
- 10. 從任何地方都可以獲得耙子任務嗎?
- 11. 如果過早停止並行任務,可以捕獲並行任務
- 12. 如何獲得芹菜所有任務和週期性任務
- 13. 如何獲取React以替換(不合並)VDOM?
- 14. 如何使用jQuery做以下任務?
- 15. 使用JBoss並獲得以下異常
- 16. 以下ruby.railstutorial.org/並獲得測試失敗
- 17. 如何構建代碼以便能夠啓動可以互相替換/替換的任務
- 18. 如何獲得並從服務器
- 19. 任何替換struct.pack?
- 20. 我如何獲得以下postgres查詢?
- 21. 如何獲得以下輸出Linq中
- 22. 我們如何獲得以下輸出?
- 23. 如何獲得以下兩個列表?
- 24. 如何獲得以下結果?
- 25. 如何獲得以下輸出?
- 26. 如何從twitter獲得以下建議?
- 27. 如何獲得以下兄弟::文本()和以下兄弟:: b?
- 28. 想獲得以下以下JSON輸出
- 29. Visual Studio的任務列表替換
- 30. 替換Maven Antrun插件中的任務
由於正則表達式本身沒有替換能力,它取決於你使用的是什麼工具。 Perl的? Java的? C#?桑達?埃德? – ibid
* [user705414](http://stackoverflow.com/users/705414/user705414)*:您應該格式化代碼(本例中爲字符串),因爲不清楚引號是否是字符串的一部分。 –