Webアプリのルーティングにおいて、各ユーザの個別ページを特殊なものにしたい場合にどういうURLにすると便利かという話に触れる。例えばr7kamuraというIDのユーザ用のページは、Twitterだと https://twitter.com/r7kamura で、GitHubだと https://github.com/r7kamura というURLになっている。 GET /:id だと他のパターンと衝突してしまう もしユーザページに GET /:id というパターンを採用すると、他のURLのパターンと競合してしまうという問題がある。どんなときに困るかと言うと、例えば https://twitter.com/about でTwitterというサービスについて説明するWebページを提供しようとすると、aboutというIDを持ったユーザ用のページが提供できなくなってしまう。 この問題に対してよく
なんかまともにうごくフリーのやつみあたらなかったというか、そういう感じだったので、つくっといた。 https://github.com/tokuhirom/autolink.js/ 動作としては以下のようなかんじになります。まあコピペしてつかうなりなんなりご自由にどうぞ。MIT ライセンスってかいてあるけど public domain 扱いでいいので。 #!/usr/bin/env node var assert = require('assert'); var al = require('../lib/autolink.js'); assert.equal(al.autolink("http://google.com/"), "<a href='http://google.com/'>http://google.com/</a>"); assert.equal(al.autolink("
パーセントエンコーディング (英: percent-encoding) とは、URIにおいて使用できない文字を使う際に行われるエンコード(一種のエスケープ)の名称である。「%」を使用していることから、この名称で呼ばれている。一般にURLエンコードとも称される。 URLエンコードには、上記のパーセントエンコーディングによる符号化と以下に記述するapplication/x-www-form-urlencodedによる符号化の2種類がある。半角スペースはパーセントエンコーディングでは「%20」に符号化されるが、application/x-www-form-urlencodedによる符号化では「+」に符号化される。 概要[編集] URL Standardでは、URLのパス部分の構文解析の際、以下 (path percent-encode set) に該当する文字であれば、UTF-8で符号化のうえパ
By John Gruber Archive The Talk Show Dithering Projects Contact Colophon Feeds / Social Sponsorship WorkOS is a modern identity and user management platform. A Liberal, Accurate Regex Pattern for Matching URLs Friday, 27 November 2009 [Update, 27 July 2010: This article has been superseded by this one, which presents a superior solution to the same problem.] A common programming problem: identify
By John Gruber Archive The Talk Show Dithering Projects Contact Colophon Feeds / Social Sponsorship Nylas is an API for email, calendar, and contacts. An Improved Liberal, Accurate Regex Pattern for Matching URLs Tuesday, 27 July 2010 Update, February 2014 I’ve posted two improved versions of my original URL-matching regex pattern on Gist. The first attempts to match any URLs, including “mailto:[e
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" unreserved = alphanum | mark reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | "[" | "]" (RFC 2732)
複数のプロセスでロック状態が異常であると判断し,そのうちの 1つがロックを解除したことにより,別のプロセスがロックしたにもか かわらず,先ほどロック状態が異常であると判断したプロセスによってこの正常なロッ クを解除されてしまう可能性があります. この方法の問題点は,異常なロック状態を解除する操作が正常なロック状態をも 解除できてしまうことにあります.逆に言えば,異常なロック状態を解除する操作に よって正常なロック状態を解除できなければ問題ないわけです.そのためにはどうす ればよいのか? 答えはロック状態が常に変化していけば よいということです.そして,これを実現するのに都合がよいのが rename による方法になります. 最初のスクリプトで説明しますと,ロックファイルが lockfile という 名前のときがロックが解除されている状態で,lockfile987654321 のよう に後ろに
regex-weburl.js @� +NV // // Regular Expression for URL validation // // Author: Diego Perini // Created: 2010/12/05 // Updated: 2018/09/12 // License: MIT // // Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Softw
First off, rolling your own regexp to parse URLs is a terrible idea. You must imagine this is a common enough problem that someone has written, debugged and tested a library for it, according to the RFCs. URIs are complex - check out the code for URL parsing in Node.js and the Wikipedia page on URI schemes. There are a ton of edge cases when it comes to parsing URLs: international domain names, ac
To clarify, I’m looking for a decent regular expression to validate URLs that were entered as user input with. I have no interest in parsing a list of URLs from a given string of text (even though some of the regexes on this page are capable of doing that). I also don’t want to allow every possible technically valid URL — quite the opposite. See the URL Standard if you’re looking to parse URLs in
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く