use dokuwiki to maintain your SQL document

I use dokuwiki to maintain my developer’s document, especial for sql statement and data struture. I want my document has those futures:

  • code highlight
  • quick jump to other user objects or views display in current page
  • identify user objects, functions , views etc.
  • change log and history

I use dokuwiki to be the platform, and do the changes:

  • modify \inc\geshi\tsql.php  ( or you can add your script file, but remember to change  code language in document )
  • at line 47 add a new array item
  • ‘KEYWORDS’ => array(
    5 => array(
    //user’s object higlighted brown.
    ‘[book as1 select1]’, ‘中文的資料’,’Tables or Views list here’,
    ),
  • at line 361 add a new array item, so you can make quick link to your tables or views etc.
    • ‘URLS’ => array(
      1 => “,
      2 => “,
      3 => “,
      4 => “,
      5 => ‘http://localhost/dokuwiki/doku.php?id={FNAMEL}’
      ),
  • if your views or tables wiki page locate in different url, you can create new items above.  {FNAMEL} mean the keywoard listed in KEYWOARD array.

關於regular expression的指令問題

關於regular expression的指令問題 – Yahoo!奇摩知識+

關於regular expression的指令問題…
假設我的文字內容如下(共五行):

Hint: newly added line~~~
Hint: how are you 你好嗎
how are you你好嗎
how are you你好嗎
Hint: Hi, there. 你好
how are you 好嗎

我想只針對"Hint:" 開頭的每一行進行搜尋,假設搜尋文字是"你好",那麼我希望只列出上述第二行跟第四行(有Hint開頭的部份)!

試過"^Hint:.*你好" ,但會列出前五行:
Hint: newly added line~~~
Hint: how are you 你好嗎
how are you你好嗎
how are you你好嗎
Hint: Hi, there. 你好
=> 這似乎是以最後一個"你好"當結尾,而以Hint當開頭的結果!但我要的是第一次遇到的"你好"當結尾,也就是Hint開頭的那一行,只要出現一次"你好",則那一行就是我要找的。

若改用"^Hint:.*?你好",這時我會找到
(1)
Hint: newly added line~~~
Hint: how are you 你好

(2)
Hint: Hi, there. 你好

情況好一點,但顯然(1)中的"Hint: newly added line~~~ “不是我要的,我該怎麼再修改呢?

麻煩高手給予指導,謝謝!

regular expression 範例


應用 Regexp “a.*b"(代表以“a"開頭以“b"結尾的任意 字串),於資料列 “12 3ab0aab4 56″ 中找尋合於該條件的字 串。 該資料列中合於 Regexp “a.*b" 的字串有 “ab", “aab",“ab0aab"。但按上列二原則「由左往右找,且盡 可能尋找最長的字串」實際上被找到的字串將為“ab0aab"。