Powered by TiddlyWiki
Message Area

Ouch.

This is still a bit of a hack. In an ideal world, clicking the save button should just give you a file save dialogue box and let you choose where to save your spanking new personal TiddlyWiki. Unfortunately doing stuff in web browsers is never that easy, and there's a couple of hoops to be jumped through. See below for a quick guide.
(source code goes here)
The steps to save your changes as a new, standalone TiddlyWiki are simple, but can be error prone.
1. Make sure that all the text is selected in the edit box above. Copy it to the clipboard.
2. Go back to the browser window showing your editted TiddlyWiki and save the HTML as a new file.
3. Open the HTML file in a text editor like Notepad. Scroll to the bottom and locate the marker lines picked out with a row of asterisks.
4. Select the text from just above that marker back up to the previous marker.
5. Paste the new text in.
6. Save the HTML file.
Suggestions or improvements welcome.

Search
Search for:
Ignore Case | Regular Expressions
Search | Cancel

OniGurumaでは以下の正規表現が使用できます。(oniguruma/RE.txtからの引用) [objc] Oniguruma Regular Expressions 2004/08/24 syntax: ONIG_SYNTAX_RUBY (default) 1. Syntax elements \ escape (enable or disable meta character meaning) | alternation (...) group [...] character class 2. Characters \t horizontal tab (0x09) \v vertical tab (0x0B) \n newline (0x0A) \r return (0x0D) \b back space (0x08) \f form feed (0x0C) \a bell (0x07) \e escape (0x1B) \nnn octal char (encoded byte value) \xHH hexadecimal char (encoded byte value) \x{7HHHHHHH} wide hexadecimal char (character code point value) \cx control char (character code point value) \C-x control char (character code point value) \M-x meta (x|0x80) (character code point value) \M-\C-x meta control char (character code point value) (* \b is effective in character class [...] only) 3. Character types . any character (except newline) \w word character (alphanumeric, "_" and multibyte char. See also "A-6. Problems") \W non-word char \s whitespace char (\t, \n, \v, \f, \r, \x20) \S non-whitespace char \d digit char \D non-digit char 4. Quantifier greedy ? 1 or 0 times * 0 or more times + 1 or more times {n,m} at least n but not more than m times {n,} at least n times {,n} at least 0 but not more than n times ({0,n}) {n} n times reluctant ?? 1 or 0 times *? 0 or more times +? 1 or more times {n,m}? at least n but not more than m times {n,}? at least n times {,n}? at least 0 but not more than n times (== {0,n}?) possessive (greedy and does not backtrack after repeated) ?+ 1 or 0 times *+ 0 or more times ++ 1 or more times ({n,m}+, {n,}+, {n}+ are possessive op. in ONIG_SYNTAX_JAVA only) ex. /a*+/ === /(?>a*)/ 5. Anchors ^ beginning of the line $ end of the line \b word boundary \B not word boundary \A beginning of string \Z end of string, or before newline at the end \z end of string \G matching start position (Ruby: previous end-of-match position) 6. Character class ^... negative class (lowest precedence operator) x-y range from x to y [...] set (character class in character class) ..&&.. intersection (low precedence at the next of ^) ex. [a-w&&[^c-g]z] ==> ([a-w] AND ([^c-g] OR z)) ==> [abh-w] * If you want to use '[', '-', ']' as a normal character in a character class, you should escape these characters by '\'. //' POSIX bracket ([:xxxxx:], negate [:^xxxxx:]) alnum alphabet or digit char alpha alphabet ascii code value: [0 - 127] blank \t, \x20 cntrl digit 0-9 graph lower print punct space \t, \n, \v, \f, \r, \x20 upper xdigit 0-9, a-f, A-F 7. Extended groups (?#...) comment (?imx-imx) option on/off i: ignore case m: multi-line (dot(.) match newline) x: extended form (?imx-imx:subexp) option on/off for subexp (?:subexp) not captured group (subexp) captured group (?=subexp) look-ahead (?!subexp) negative look-ahead (?<=subexp) look-behind (?<!subexp) negative look-behind Subexp of look-behind must be fixed character length. But different character length is allowed in top level alternatives only. ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed. In negative-look-behind, captured group isn't allowed, //' but shy group(?:) is allowed. (?>subexp) atomic group don't backtrack in subexp. //' (?<name>subexp) define named group (All characters of the name must be a word character. And first character must not be a digit or uppper case) Not only a name but a number is assigned like a captured group. Assigning the same name as two or more subexps is allowed. In this case, a subexp call can not be performed although the back reference is possible. 8. Back reference \n back reference by group number (n >= 1) \k<name> back reference by group name In the back reference by the multiplex definition name, a subexp with a large number is referred to preferentially. (When not matched, a group of the small number is referred to.) * Back reference by group number is forbidden if named group is defined in the pattern and ONIG_OPTION_CAPTURE_GROUP is not setted. 9. Subexp call ("Tanaka Akira special") \g<name> call by group name \g<n> call by group number (n >= 1) * left-most recursive call is not allowed. ex. (?<name>a|\g<name>b) => error (?<name>a|b\g<name>c) => OK * Call by group number is forbidden if named group is defined in the pattern and ONIG_OPTION_CAPTURE_GROUP is not setted. * If the option status of called group is different from calling position then the group's option is effective. //' ex. (?-i:\g<name>)(?i:(?<name>a)){0} match to "A" 10. Captured group Behavior of the no-named group (...) changes with the following conditions. (But named group is not changed.) case 1. /.../ (named group is not used, no option) (...) is treated as a captured group. case 2. /.../g (named group is not used, 'g' option) (...) is treated as a no-captured group (?:...). case 3. /..(?<name>..)../ (named group is used, no option) (...) is treated as a no-captured group (?:...). numbered-backref/call is not allowed. case 4. /..(?<name>..)../G (named group is used, 'G' option) (...) is treated as a captured group. numbered-backref/call is allowed. where g: ONIG_OPTION_DONT_CAPTURE_GROUP G: ONIG_OPTION_CAPTURE_GROUP ('g' and 'G' options are argued in ruby-dev ML) These options are not implemented in Ruby level. ----------------------------- A-1. Syntax depend options + ONIG_SYNTAX_RUBY (?m): dot(.) match newline + ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA (?s): dot(.) match newline (?m): ^ match after newline, $ match before newline A-2. Original extensions + named group (?<name>...) + named backref \k<name> + subexp call \g<name>, \g<group-num> A-3. Lacked features compare with perl 5.8.0 + [:word:] + \N{name} + \l,\u,\L,\U, \X, \C + (?{code}) + (??{code}) + (?(condition)yes-pat|no-pat) * \Q...\E This is effective on ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA. * \p{property}, \P{property} This is effective on ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA. Alnum, Alpha, Blank, Cntrl, Digit, Graph, Lower, Print, Punct, Space, Upper, XDigit, ASCII are supported. Prefix 'Is' of property name is allowed in ONIG_SYNTAX_PERL only. ex. \p{IsXDigit}. Negation operator of property is supported in ONIG_SYNTAX_PERL only. \p{^...}, \P{^...} A-4. Differences with Japanized GNU regex(version 0.12) of Ruby + add look-behind (?<=fixed-char-length-pattern), (?<!fixed-char-length-pattern) + add possessive quantifier. ?+, *+, ++ + add operations in character class. [], && ('[' must be escaped as an usual char in character class.) + add named group and subexp call. + octal or hexadecimal number sequence can be treated as a multibyte code char in character class if multibyte encoding is specified. (ex. [\xa1\xa2], [\xa1\xa7-\xa4\xa1]) + allow the range of single byte char and multibyte char in character class. ex. /[a-<<any EUC-JP character>>]/ in EUC-JP encoding. + effect range of isolated option is to next ')'. ex. (?:(?i)a|b) is interpreted as (?:(?i:a|b)), not (?:(?i:a)|b). + isolated option is not transparent to previous pattern. ex. a(?i)* is a syntax error pattern. + allowed incompleted left brace as an usual string. ex. /{/, /({)/, /a{2,3/ etc... + negative POSIX bracket [:^xxxx:] is supported. + POSIX bracket [:ascii:] is added. + repeat of look-ahead is not allowed. ex. /(?=a)*/, /(?!b){5}/ + Ignore case option is effective to numbered character. ex. /\x61/i =~ "A" + In the range quantifier, the number of the minimum is omissible. /a{,n}/ == /a{0,n}/ The simultanious abbreviation of the number of times of the minimum and the maximum is not allowed. (/a{,}/) + /a{n}?/ is not a non-greedy operator. /a{n}?/ == /(?:a{n})?/ + Zero-length match in infinite repeat stops the repeat, then changes of the capture group status are checked as stop condition. /(?:()|())*\1\2/ =~ "" /(?:\1a|())*/ =~ "a" A-5. Disabled functions by default syntax + capture history (?@...) and (?@<name>...) ex. /(?@a)*/.match("aaa") ==> [<0-1>, <1-2>, <2-3>] see sample/listcap.c file. A-6. Problems + Invalid encoding byte sequence is not checked in UTF-8. * Invalid first byte is treated as a character. /./u =~ "\xa3" * Incomplete byte sequence is not checked. /\w+/ =~ "a\xf3\x8ec" + Character types of multibyte encoded characters are not correct. All multibyte encoded characters are treated as word(\w) character. (and POSIX bracket [:graph:], [:print:] type) In UTF-8 and UTF-16, only the multibyte character in code point [U+0080 - U+00FF] is correctly judged in a character type. // END [/objc]
#FindSample (検索) #ReplaceSample (置換)
HelloThere AboutCreators AboutProjects RegularExpressions ReplaceExpressions SampleCodes TipsAndTricks ToDo [[Acknowledgement]] Copyright 2004 IsaoSonobe
OgreKit Wiki
皆様、ご紹介、ご使用、ご意見、ご協力頂きありがとうございます! Oniguruma作者・小迫様 <[[link|http://www.geocities.jp/kosako1/oniguruma/index.html]]> Apple Computer様 <[[link|http://www.apple.com/downloads/macosx/index.html]]> アップルコンピュータ様 <[[link|http://www.apple.co.jp/downloads/macosx/index.html]]> 新しもの好きのダウンロード・早川厚志様 <[[link|http://mac.page.ne.jp/]]> 日記的「駄目」プログラミング・YOUsuke様 <[[link|http://www.trinity-site.net/diary/]]> 九龍的家頁・あに様 <[[link|http://www10.plala.or.jp/kowloon/]]> HAPPY Macintosh Developing TIME!・木下誠(mkino)様 <[[link|http://homepage.mac.com/mkino2/]]> お笑いパソコン日誌・Terry Minamino様 <[[link|http://www2s.biglobe.ne.jp/~chic/pilot.html]]> Digitalians' Alchemy・Alchemist様 <[[link|http://homepage1.nifty.com/alchemy/index.html]]> MacOSX Freewares様 <[[link|http://www.geocities.jp/akamayu2/]]> 気まぐれ開発日誌・soleil様 <[[link|http://d.hatena.ne.jp/soleil/]]> Cocoa Dev様 <[[link|http://www.cocoadev.com/index.pl?RegularExpressions]]> ClassWiki様 <[[link|http://www.cs.uidaho.edu/~bruceb/cgi-bin/ClassWiki/index.cgi?RegularExpressions]]> pythonmac.org・Bob Ippolito様 <[[link|http://pythonmac.org/wiki/XcodeIntegration]]> Kino様 かりやん日記・狩野正嗣様 <[[link|http://www2.diary.ne.jp/user/63813]]> ヘチマコンピュータ様 <[[link|http://hetima.com/index.html]]> Hao Li様 <[[link|http://haoli.dnsalias.com/]]> アートマン21・松本慧様 <[[link|http://www.artman21.net/]]> whitebug's Diary・whitebug様 <[[link|http://shaft.dyndns.org/~shaft/diary/]]> UTF(OTF) tools & Sasakia(日本語TeXの数式を直にPDF/PNGにできるソフト)・伊東悠様 <[[link|http://www.kawachi.zaq.ne.jp/dpbnk800/]]> S. Zenitani のウェブサイト、ＯＷヨＷ 人Ｗ ([[link|http://d.hatena.ne.jp/reconnection/]])・銭谷誠司様 <[[link|http://homepage.mac.com/zenitani/Menu15.html]]> Mac Freaks・J-Klein様 <[[link|http://members.jcom.home.ne.jp/j-klein/]]> tmaeda日記・tmaeda様 <[[link|http://tmaeda.s45.xrea.com/td/]]> GyazMail -- An all-new email client for Mac OS X --・平川剛一様 <[[link|http://gyazsquare.com/gyazmail/]]> TeXShop・Richard Koch様はじめ、TeXShop開発者コミュニティの皆様 <[[link|http://www.uoregon.edu/~koch/texshop/texshop.html]]> Lightweight Language Magazine、ASCII様 SubEthaEdit・Martin Pittenauer様、Martin Ott様 <[[link|http://www.codingmonkeys.de/subethaedit/]]> fay-erie様 <[[link|http://fay-erie.net/]]> SyntaxError・Y. Hanatani様 <[[link|http://www.lab2.kuis.kyoto-u.ac.jp/~hanatani/tdiary/]]> MACSTUDIO BLOG・MACSTUDIO NETWORKS様 <[[link|http://www.macstudio.net/blog/]]> Cocoa+++ObjectiveC様 <[[link|http://itools.jp/~0003/]]> Caffeine, Nicotine and Macintosh・yuichirookada様 <[[link|http://nicotine.exblog.jp/]]> DrunkenBlog様 <[[link|http://www.drunkenblog.com/]]> iTteyoshi (2ch Browser for Mac OS X)・haneco様 <[[link|http://www.geocities.co.jp/SiliconValley-Sunnyvale/9264/]]> Tumult HyperEdit・Jonathan Deutsch様 <[[link|http://www.tumultco.com/HyperEdit/]]> Syonan Macintosh Users Group様 <[[link|http://www21.big.or.jp/~simayugu/]]> 330's Weblog・三沢徳章様 <[[link|http://www.misawa.net/]]> Smultron・Peter Borg様 <[[link|http://sourceforge.net/projects/smultron/]]> Pufui・谷津真樹様 <[[link|http://yatsu.info/wiki/Pufui/]]>
FindPanelModelsは検索パネルによる検索操作(TextFindFunctions)、検索対象のラッパー(TextFindComponents)、検索結果(TextFindResults)に関するクラスの集合です。
OniGuruma(鬼車)<[[link|http://www.geocities.jp/kosako1/oniguruma/index.html]]>は小迫さんにより開発されている様々な構文や文字エンコーディングを扱える特徴を持った正規表現ライブラリです。 使用できる正規表現はRegularExpressionsを参照してください。 OniGurumaはOniGurumaLicenseの下で公開されています。
Design and Coding: *IsaoSonobe Localization: *Japanese and English: IsaoSonobe *German: Martin Kerz *Spanish: Juan Luis Varona Malumbres Thank you very much for your kind cooperation!
FoundationLayerは正規表現機能を提供する以下のクラスの集合です。 *OGRegularExpression (正規表現を表す) *OGRegularExpressionEnumerator (検索を行う) *OGRegularExpressionMatch (検索結果) *OGRegularExpressionCapture (検索履歴) *OGReplaceExpression (置換を行う) *OGRegularExpressionFormatter (正規表現フォーマッタ) この他に文字列を抽象化したOGStringProtocolやOGMutableStringProtocolもありますが、直接触れることはありません。
ApplicationLayerは検索パネル機能を提供する多数のクラスの集合です。 クラスは *FindPanelModels (検索操作、検索対象のラッパー、検索結果) *FindPanelControllers (検索パネル) *FindPanelViews (検索対象ビュー) に大別できます。
検索操作の骨組みの役割を果たすクラスは次のものです。字下げはクラス継承を表しています。 *OgreTextFinder (検索操作の窓口 (Facade Pattern)) *OgreTextFindThread (検索操作のテンプレート (Template Method Pattern、Visitor Pattern)) **OgreFindAllThread (一括検索操作) **OgreReplaceAllThread (一括置換操作) **OgreHighlightThread (ハイライト操作) **OgreUnhighlightThread (ハイライト取り消し操作) **OgreFindThread (検索操作) ***OgreReplaceAndFindThread (置換後検索操作) OgreTextFindThreadはnon-preemptive multithreadでOgreTextFindComponentをvisitするVisitorです。
TextFindComponentsは検索対象のラッパーに関するクラスの集合です。 まずは骨組みの役割を果たす抽象クラスやプロトコルは次のものです。字下げはクラス継承やプロトコル適合を表しています。 *OgreTextFindComponent (検索対象のラッパー要素 (Composite Pattern、Visitor Pattern)) **OgreTextFindBranch (検索対象のラッパー (枝)) ***OgreTextFindRoot (検索対象のラッパー (根)) **OgreTextFindLeaf (検索対象のラッパー (葉)) *OgreTextFindComponentEnumerator (検索対象のラッパーの列挙子) **OgreTextFindReverseComponentEnumerator (検索対象のラッパーの逆順列挙子) 現時点で提供されている検索対象のラッパーには *NSTextView(OgreTextView)用 *OgreTableViewとOgreTableColumn用 *OgreOutlineViewとOgreOutlineColumn用 があります。 NSTextView(OgreTextView)用には *プレインテキスト用のOgreTextViewPlainAdapter *RTF用のOgreTextViewRichAdapter *RTFD用のOgreTextViewGraphicAllowedAdapter があります。OgreTextViewAdapterはこれらの窓口です。 また、OgreTextViewUndoerはUndo操作を行うためのユーティリティクラスです。 OgreTableViewとOgreTableColumn用のラッパークラスには、 #OgreTableViewAdater #OgreTableColumnAdapter #OgreTableCellAdapter の順で親子関係があります。 OgreOutlineViewとOgreOutlineColumn用のラッパークラスにもOgreTableViewAdapterと同様の親子関係があります。 #OgreOutlineViewAdapter #OgreOutlineColumnAdapter #OgreOutlineItemAdapter (1回以上の繰り返し) #OgreOutlineCellAdapter の順です。ここでOgreOutlineItemAdapterが子要素としてOgreOutlineItemAdapterを持つことがある点がOgreTableCellAdapterの場合と異なります。
TiddlyWiki<http://www.tiddlywiki.com/ >はJeremy Ruston氏が開発したWikiシステムです。ひとつのHTMLファイルでデータの出力と入力補助、保持を行えるという特徴を持ちます。従って、特別なサーバを必要とせず、JavaScriptの実行できるWebブラウザとテキストエディタさえあれば容易にWikiを構築できます。閲覧にはSafariをお勧めします。 OgreKit Wikiの構築には私的に機能を追加したCustomizedTiddlyWikiを使用しています。
#OgreKitLicense (使用上の注意点) #MemoryManagementTips (メモリ管理について)
HelloThere OgreKit IsaoSonobe
[java] import java.lang.*; import java.util.*; import java.text.*; /** * This is about <code>ClassName</code>. * {@link com.yourCompany.aPackage.SuperClass} * @author author */ class Test { public static void main(String[] args) { Calendar cal = new GregorianCalendar(new Locale("ja", "JP")); DateFormat dateFormatter = DateFormat.getDateInstance(); try { Date date = dateFormatter.parse("2004/7/30"); cal.setTime(date); System.out.println(cal.getTime()); // day of week Map dayOfWeek = new HashMap(); dayOfWeek.put(new Integer(Calendar.SUNDAY), "Sun"); dayOfWeek.put(new Integer(Calendar.MONDAY), "Mon"); dayOfWeek.put(new Integer(Calendar.TUESDAY), "Tue"); dayOfWeek.put(new Integer(Calendar.WEDNESDAY), "Wed"); dayOfWeek.put(new Integer(Calendar.THURSDAY), "Thu"); dayOfWeek.put(new Integer(Calendar.FRIDAY), "Fri"); dayOfWeek.put(new Integer(Calendar.SATURDAY), "Sat"); System.out.println("day of week: " + dayOfWeek.get(new Integer(cal.get(Calendar.DAY_OF_WEEK)))); System.out.println("actual minimum of date:" + cal.getActualMinimum(Calendar.DATE)); System.out.println("actual maximum of date:" + cal.getActualMaximum(Calendar.DATE)); System.out.println("week of month:" + cal.get(Calendar.WEEK_OF_MONTH)); } catch (ParseException e) { System.out.println(e); } } } [/java]
[xml] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- DataSource --> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:comp/env/TiddlyWikiPrimeDataSource</value> </property> </bean> <!-- Hibernate SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean" destroy-method="destroy"> <property name="mappingResources"> <list> <value>app/dao/hibernate/User.hbm.xml</value> <value>app/dao/hibernate/Category.hbm.xml</value> <value>app/dao/hibernate/Tiddler.hbm.xml</value> <value>app/dao/hibernate/RelUserCategory.hbm.xml</value> </list> </property> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> net.sf.hibernate.dialect.PostgreSQLDialect </prop> <prop key="hibernate.show_sql"> true </prop> <prop key="hibernate.use_outer_join"> true </prop> </props> </property> </bean> <!-- Transaction Manager --> <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!-- Business Interface --> <bean id="adminService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref local="transactionManager"/> </property> <property name="target"> <ref local="adminServiceTarget"/> </property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"> <ref local="transactionManager"/> </property> <property name="target"> <ref local="userServiceTarget"/> </property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- Business Object --> <bean id="adminServiceTarget" class="app.domain.AdminServiceImpl"> <property name="userDao"> <ref local="userDao"/> </property> <property name="categoryDao"> <ref local="categoryDao"/> </property> <property name="tiddlerDao"> <ref local="tiddlerDao"/> </property> <property name="relUserCategoryDao"> <ref local="relUserCategoryDao"/> </property> </bean> <bean id="userServiceTarget" class="app.domain.UserServiceImpl"> <property name="userDao"> <ref local="userDao"/> </property> <property name="categoryDao"> <ref local="categoryDao"/> </property> <property name="tiddlerDao"> <ref local="tiddlerDao"/> </property> <property name="relUserCategoryDao"> <ref local="relUserCategoryDao"/> </property> </bean> <!-- Data Access Object --> <bean id="userDao" class="app.dao.hibernate.HibernateUserDao"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="categoryDao" class="app.dao.hibernate.HibernateCategoryDao"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="tiddlerDao" class="app.dao.hibernate.HibernateTiddlerDao"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="relUserCategoryDao" class="app.dao.hibernate.HibernateRelUserCategoryDao"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> </beans> [/xml]
[objc] // create a regular expression object OGRegularExpression *regex = [OGRegularExpression regularExpressionWithString:@"a[^a]*a"]; // get matcher NSEnumerator *matcher = [regex matchEnumeratorInString:@"alphabetagammadelta"]; // get match result objects sequentially OGRegularExpressionMatch *match; while ((match = [matcher nextObject]) != nil) { NSLog(@"%@", [match matchedString]); // print found string } // LOG: // alpha // aga // adelta [/objc]
some about a regular expression framework
文字列中の正規表現にマッチした部分すべてを置換する。 [objc] // create a regular expression object OGRegularExpression *regex = [OGRegularExpression regularExpressionWithString:@"a[^a]*a"]; // replaces all occurrences of target string with evaluated replace expressions NSLog(@"%@", [regex replaceAllMatchesInString:@"alphabetagammadelta" withString:@"(\\0)"]); // LOG: (alpha)bet(aga)mm(adelta) [/objc]
マッチ数が多い場合には次のコードのようにautorelease poolを定期的に解放することをお勧めします。 [objc] OGRegularExpression *regex = [OGRegularExpression regularExpressionWithString:@"a[^a]*a"]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; unsigned autoreleaseCount = 0; // get too many match result objects sequentially NSEnumerator *matcher = [regex matchEnumeratorInString:@"tooooooLongString"]; OGRegularExpressionMatch *match; while ((match = [matcher nextObject]) != nil) { NSLog(@"%@", [match matchedString]); autoreleaseCount++; if (autoreleaseCount == 100) { // refresh periodically autorelease pool autoreleaseCount = 0; [pool release]; pool = [[NSAutoreleasePool alloc] init]; } } [pool release]; [/objc]
文字列中の正規表現にマッチした部分を順番に得る。 [objc] // create a regular expression object OGRegularExpression *regex = [OGRegularExpression regularExpressionWithString:@"a[^a]*a"]; // get matcher NSEnumerator *matcher = [regex matchEnumeratorInString:@"alphabetagammadelta"]; // get match result objects sequentially OGRegularExpressionMatch *match; while ((match = [matcher nextObject]) != nil) { NSLog(@"%@", [match matchedString]); // print found string } // LOG: // alpha // aga // adelta [/objc] マッチ数が多くなる場合にはMemoryManagementTipsのようにautorelease poolを定期的に解放してください。
-[OGRegularExpression matchEnumeratorInString:]等の戻り値はNSEnumeratorを継承したOGRegularExpressionEnumeratorです。しかし、大概の利用範囲ではオーバーライドしたNSEnumeratorのメソッドnextObjectとallObjectsで十分なことと、何よりOGRegularExpressionEnumeratorは打つのが嫌になるほど長い名前なので [objc]NSEnumerator *matcher = [regex matchEnumeratorInString:@"alphabetagammadelta"]; [/objc] のようにNSEnumeratorとして戻り値を受けることが多いです。
[[日本語WikiName]]も使用できます。
|Standard Periodic Table (ref. Wikipedia)|c || !1 | !2 |!| !3 | !4 | !5 | !6 | !7 | !8 | !9 | !10 | !11 | !12 | !13 | !14 | !15 | !16 | !17 | !18 | |!1|bgcolor(#a0ffa0): @@color(red):H@@ |>|>|>|>|>|>|>|>|>|>|>|>|>|>|>|>||bgcolor(#c0ffff): @@color(red):He@@ | |!2|bgcolor(#ff6666): Li |bgcolor(#ffdead): Be |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccc99): B |bgcolor(#a0ffa0): C |bgcolor(#a0ffa0): @@color(red):N@@ |bgcolor(#a0ffa0): @@color(red):O@@ |bgcolor(#ffff99): @@color(red):F@@ |bgcolor(#c0ffff): @@color(red):Ne@@ | |!3|bgcolor(#ff6666): Na |bgcolor(#ffdead): Mg |>|>|>|>|>|>|>|>|>|>||bgcolor(#cccccc): Al |bgcolor(#cccc99): Si |bgcolor(#a0ffa0): P |bgcolor(#a0ffa0): S |bgcolor(#ffff99): @@color(red):Cl@@ |bgcolor(#c0ffff): @@color(red):Ar@@ | |!4|bgcolor(#ff6666): K |bgcolor(#ffdead): Ca ||bgcolor(#ffc0c0): Sc |bgcolor(#ffc0c0): Ti |bgcolor(#ffc0c0): V |bgcolor(#ffc0c0): Cr |bgcolor(#ffc0c0): Mn |bgcolor(#ffc0c0): Fe |bgcolor(#ffc0c0): Co |bgcolor(#ffc0c0): Ni |bgcolor(#ffc0c0): Cu |bgcolor(#ffc0c0): Zn |bgcolor(#cccccc): Ga |bgcolor(#cccc99): Ge |bgcolor(#cccc99): As |bgcolor(#a0ffa0): Se |bgcolor(#ffff99): @@color(green):Br@@ |bgcolor(#c0ffff): @@color(red):Kr@@ | |!5|bgcolor(#ff6666): Rb |bgcolor(#ffdead): Sr ||bgcolor(#ffc0c0): Y |bgcolor(#ffc0c0): Zr |bgcolor(#ffc0c0): Nb |bgcolor(#ffc0c0): Mo |bgcolor(#ffc0c0): Tc |bgcolor(#ffc0c0): Ru |bgcolor(#ffc0c0): Rh |bgcolor(#ffc0c0): Pd |bgcolor(#ffc0c0): Ag |bgcolor(#ffc0c0): Cd |bgcolor(#cccccc): In |bgcolor(#cccccc): Sn |bgcolor(#cccc99): Sb |bgcolor(#cccc99): Te |bgcolor(#ffff99): I |bgcolor(#c0ffff): @@color(red):Xe@@ | |!6|bgcolor(#ff6666): Cs |bgcolor(#ffdead): Ba |bgcolor(#ffbfff):^^*1^^|bgcolor(#ffc0c0): Lu |bgcolor(#ffc0c0): Hf |bgcolor(#ffc0c0): Ta |bgcolor(#ffc0c0): W |bgcolor(#ffc0c0): Re |bgcolor(#ffc0c0): Os |bgcolor(#ffc0c0): Ir |bgcolor(#ffc0c0): Pt |bgcolor(#ffc0c0): Au |bgcolor(#ffc0c0): @@color(green):Hg@@ |bgcolor(#cccccc): Tl |bgcolor(#cccccc): Pb |bgcolor(#cccccc): Bi |bgcolor(#cccc99): Po |bgcolor(#ffff99): At |bgcolor(#c0ffff): @@color(red):Rn@@ | |!7|bgcolor(#ff6666): Fr |bgcolor(#ffdead): Ra |bgcolor(#ff99cc):^^*2^^|bgcolor(#ffc0c0): Lr |bgcolor(#ffc0c0): Rf |bgcolor(#ffc0c0): Db |bgcolor(#ffc0c0): Sq |bgcolor(#ffc0c0): Bh |bgcolor(#ffc0c0): Hs |bgcolor(#ffc0c0): Mt |bgcolor(#ffc0c0): Ds |bgcolor(#ffc0c0): Rg |bgcolor(#ffc0c0): @@color(green):Uub@@ |bgcolor(#cccccc): Uut |bgcolor(#cccccc): Uuq |bgcolor(#cccccc): Uup |bgcolor(#cccccc): Uuh |bgcolor(#fcfecc): @@color(#cccccc):Uus@@ |bgcolor(#ecfefc): @@color(#cccccc):Uuo@@ | | !Lanthanides^^*1^^|bgcolor(#ffbfff): La |bgcolor(#ffbfff): Ce |bgcolor(#ffbfff): Pr |bgcolor(#ffbfff): Nd |bgcolor(#ffbfff): Pm |bgcolor(#ffbfff): Sm |bgcolor(#ffbfff): Eu |bgcolor(#ffbfff): Gd |bgcolor(#ffbfff): Tb |bgcolor(#ffbfff): Dy |bgcolor(#ffbfff): Ho |bgcolor(#ffbfff): Er |bgcolor(#ffbfff): Tm |bgcolor(#ffbfff): Yb | | !Actinides^^*2^^|bgcolor(#ff99cc): Ac |bgcolor(#ff99cc): Th |bgcolor(#ff99cc): Pa |bgcolor(#ff99cc): U |bgcolor(#ff99cc): Np |bgcolor(#ff99cc): Pu |bgcolor(#ff99cc): Am |bgcolor(#ff99cc): Cm |bgcolor(#ff99cc): Bk |bgcolor(#ff99cc): Cf |bgcolor(#ff99cc): Es |bgcolor(#ff99cc): Fm |bgcolor(#ff99cc): Md |bgcolor(#ff99cc): No | *Chemical Series of the Periodic Table **@@bgcolor(#ff6666): Alkali metals@@ **@@bgcolor(#ffdead): Alkaline earth metals@@ **@@bgcolor(#ffbfff): Lanthanides@@ **@@bgcolor(#ff99cc): Actinides@@ **@@bgcolor(#ffc0c0): Transition metals@@ **@@bgcolor(#cccccc): Poor metals@@ **@@bgcolor(#cccc99): Metalloids@@ **@@bgcolor(#a0ffa0): Nonmetals@@ **@@bgcolor(#ffff99): Halogens@@ **@@bgcolor(#c0ffff): Noble gases@@ *State at standard temperature and pressure **those in @@color(red):red@@ are gases **those in @@color(green):green@@ are liquids **those in black are solids
''Bold'' ==Strike== __Underline__ //Italic// 2^^3^^=8 a~~ij~~ = -a~~ji~~ @@highlight@@ @@color(green):green colored@@ @@bgcolor(#ff0000):color(#ffffff):red colored@@
OgreKit(オウガキット)はCocoa用正規表現フレームワークです。(OgreKitLogo) Rubyと同等の正規表現処理機能を提供するFoundationLayerと、高機能検索パネル([[screenshot|/img/TiddlyWikiPrime/OgreKitLShot.png]])を提供するApplicationLayerという2つの階層から構成されています。 使用している正規表現ライブラリは小迫さん作のOniGurumaです。 OniGurumaはRubyで使用されている正規表現ライブラリです。 ライセンスはOniGurumaのライセンスに準じています。ほぼBSDライセンスです。 詳しくはOgreKitLicenseを参照してください。
OgreKitに関するお問い合わせは園部勲<sonoisa (AT) muse (DOT) ocn (DOT) ne (DOT) jp>までお願いします。
OgreKitLicenseはほぼBSDライセンスです。簡単に言えば、OgreKitとOniGurumaの著作権表示(OgreKitLicenseとOniGurumaLicense)さえすれば、商用・非商用、改変の有無、ソースのオープン・クローズドに関わらず使用できるというライセンスです。 また、GNU GPLライセンスを採用しているソフトに組み込み、配布する事もできます(参考サイト: http://www.gnu.org/licenses/license-list.ja.html#ModifiedBSD )。 [objc]OgreKit License --------------- The license of OgreKit follows that of OniGuruma. It follows the BSD license in the case of the one except for it. /* * Copyright (c) 2003 Isao Sonobe <sonoisa (AT) muse (DOT) ocn (DOT) ne (DOT) jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */[/objc]
(oniguruma/COPYINGからの引用) [objc]OniGuruma LICENSE ----------------- When this software is partly used or it is distributed with Ruby, this of Ruby follows the license of Ruby. It follows the BSD license in the case of the one except for it. /*- * Copyright (c) 2002-2004 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */[/objc]
[img[OgreKit Logo|http://www-gauge.scphys.kyoto-u.ac.jp/~sonobe/OgreKit/OgreKitLogo.gif]] OniGuruma Regular Expressionの頭文字をとったOGREには英語で鬼の意味があるのでストレートに鬼と書いてみました。OniGuruma(鬼車)の鬼にもかかっています。
OgreKit WikiはOgreKitに関する知識をまとめたデータベースです。 構築には私的に機能を追加したCustomizedTiddlyWikiを使用しています。
[img[OgreKit Logo|http://www-gauge.scphys.kyoto-u.ac.jp/~sonobe/OgreKit/OgreKitLogo.gif]]
----
*sample: |!th1111111111|!th2222222222| |>| colspan | | rowspan |left| |~| right| |bgcolor(#a0ffa0):colored| center | |caption|c *another sample: see PeriodicTable.
JeremyRuston saids <<< A TiddlyWiki is like a blog because it's divided up into neat little chunks, but it encourages you to read it by hyperlinking rather than sequentially: if you like, a non-linear blog analogue that binds the individual microcontent items into a cohesive whole. I think that TiddlyWiki represents a novel medium for writing, and will promote it's own distinctive WritingStyle. This is the first version of TiddlyWiki and so, as discussed in TiddlyWikiDev, it's bound to be FullOfBugs, have many MissingFeatures and fail to meet all of the DesignGoals. And of course there's NoWarranty, and it might be judged a StupidName. <<< >level 1 >level 1 >>level 2 >>level 2 >>>level 3 >>>level 3 >>level 2 >level 1
start #item1 #item2 ##item2.1 ##item2.2 ##item2.3 #item3 ##item3.1 ###item3.1.1 ###item3.1.2 end
start *item1 **item1.1 **item1.2 ***item1.2.1 ***item1.2.2 ***item1.2.3 **item1.3 **item1.4 *item2 end
!Header 1 !!Header 2 !!!Header 3 !!!!Header 4 !!!!!Header 5
[[日本語WikiName]]も使用できます。
カスタマイズした内容 *BracketNames *[[Headers]] *BulletLists *NumberedLists *BlockQuotes *[[Tables]] *HorizontalLines *Syntax Highlighting **[[Objective-C Syntax]] **JavaSyntax **XMLSyntax *Search with Regular Expressions (based on [[TiddlyWikiPlus|http://tiddlywiki.nm.ru/]]) click 'search' button on the top right-hand corner of the page. *[[Styles]] *[[Images]]