Regular Expressions Cheat Sheet
^ |
The pattern has to appear at the beginning of a string. | ^cat matches any string that begins with cat |
|---|---|---|
$ |
The pattern has to appear at the end of a string. | cat$ matches any string that ends with cat |
. |
Matches any character. | cat. matches catT and cat2 but not catty |
[] |
Bracket expression. Matches one of any characters enclosed. | gr[ae]y matches gray or grey |
[^] |
Negates a bracket expression. Matches one of any characters EXCEPT those enclosed. | 1[^02] matches 13 but not 10 or 12 |
[-] |
Range. Matches any characters within the range. | [1-9] matches any single digit EXCEPT 0 |
? |
Preceeding item must match one or zero times. | colou?r matches color or colour but not colouur |
+ |
Preceeding item must match one or more times. | be+ matches be or bee but not b |
* |
Preceeding item must match zero or more times. | be* matches b or be or beeeeeeeeee |
() |
Parentheses. Creates a substring or item that metacharacters can be applied to | a(bee)?t matches at or abeet but not abet |
{n} |
Bound. Specifies exact number of times for the preceeding item to match. | [0-9]{3} matches any three digits |
{n,} |
Bound. Specifies minimum number of times for the preceeding item to match. | [0-9]{3,} matches any three or more digits |
{n,m} |
Bound. Specifies minimum and maximum number of times for the preceeding item to match. | [0-9]{3,5} matches any three, four, or five digits |
| |
Alternation. One of the alternatives has to match. | July (first|1st|1) will match July 1st but not July 2 |
POSIX Character Classes
[:alnum:] |
alphanumeric character | [[:alnum:]]{3} matches any three letters or numbers, like 7Ds |
|---|---|---|
[:alpha:] |
alphabetic character, any case | [[:alpha:]]{5} matches five alphabetic characters, any case, like aBcDe |
[:blank:] |
space and tab | [[:blank:]]{3,5} matches any three, four, or five spaces and tabs |
[:digit:] |
digits | [[:digit:]]{3,5} matches any three, four, or five digits, like 3, 05, 489 |
[:lower:] |
lowercase alphabetics | [[:lower:]] matches a but not A |
[:punct:] |
punctuation characters | [[:punct:]] matches ! or . or , but not a or 3 |
[:space:] |
all whitespace characters, including newline and carriage return | [[:space:]] matches any space, tab, newline, or carriage return |
[:upper:] |
uppercase alphabetics | [[:upper:]] matches A but not a |
Perl-Style Metacharacters
// |
Default delimiters for pattern | /colou?r/ matches color or colour |
|---|---|---|
i |
Append to pattern to specify a case insensitive match | /colou?r/i matches COLOR or Colour |
\b |
A word boundary, the spot between word (\w) and non-word (\W) characters |
/\bfred\b/i matches Fred but not Alfred or Frederick |
\B |
A non-word boundary | /fred\B/i matches Frederick but not Fred |
\d |
A single digit character | /a\db/i matches a2b but not acb |
\D |
A single non-digit character | /a\Db/i matches aCb but not a2b |
\n |
The newline character. (ASCII 10) | /\n/ matches a newline |
\r |
The carriage return character. (ASCII 13) | /\r/ matches a carriage return |
\s |
A single whitespace character | /a\sb/ matches a b but not ab |
\S |
A single non-whitespace character | /a\Sb/ matches a2b but not a b |
\t |
The tab character. (ASCII 9) | /\t/ matches a tab. |
\w |
A single word character – alphanumeric and underscore | /\w/ matches 1 or _ but not ? |
\W |
A single non-word character | /a\Wb/i matches a!b but not a2b |
Thoughts about BizTalk VNext
Recently a few of us were speaking about what would be the future of BizTalk after the 2009 release. I already had a few thoughts on what I think would be great additions to the product and what strategic directions it may move in. I have checked to ensure that none of my thoughts breach the MVP NDA and after getting the thumbs up I’ve listed my thoughts below so there might be a bit of discussion on these ideas.
|
Area |
Thought |
Notes |
|
Improved or New Feature |
Configuration Subsystem |
Within BizTalk solutions we regularly need to store configuration somewhere for implementing a process. This is a real pain and there are multiple ways this can be done. The main problems are:
|
|
Suggestion |
Velocity |
There are a number of places where BizTalk uses caching or should use caching. I think BizTalk should be looking at how Velocity could be leveraged in future versions to make things easier for BizTalk people and also using it under the hood. I have previously wrote an article about using Ncache with BizTalk Cross Referencing which shows some ways that distributed caching can be taken advantage of: http://geekswithblogs.net/michaelstephenson/archive/2008/09/21/125353.aspx And http://geekswithblogs.net/michaelstephenson/archive/2008/09/21/125352.aspx I think it could also offer an opportunity to look at this to help you with the low latency question in BizTalk. Possibly by having a distributed in memory message box and the normal database one. You could then do something like a provider pattern and allow a host to choose which kind of message box to work with. Bit of an out there idea, but food for thought anyway. |
|
Suggestion |
Dublin Integration |
One of the key things for BizTalk from now on in my opinion is how integration with Dublin is utilised and how solutions are developed taking advantages of both products.
I think it could be a good idea to look at how Dublin may take advantage of BizTalk features and visa versa.
Some of my thoughts on what a dublin solution might want to take advantage of from BizTalk are:
|
|
Map Enhancements |
A whole bunch of thoughts about maps |
|
|
Schemas/Messages |
Bunch of suggestions |
|
|
Pipeline Components |
Pipeline Component Wizard |
Implement this as a visual studio component |
|
Pipelines |
Get rid of Pipelines |
I believe that there is no value from the pipeline artefact. If you examine it in reflector you will see a pipeline is simply a class containing a string of xml which is made available as a property. The string of xml is a description of the pipeline components that should be executed. I would prefer if this artefact was deprecated and instead you would define pipelines through the port bindings where you could list the pipeline components. This would have the benefit of being able to add and remove pipeline components to a port at runtime by an administrator. It would also be great if in the bindings you could define a list of reusable groups of pipeline components (essentially defining a pipeline in the bindings and being able to reuse it on multiple ports. The root thing is that in my opinion because the pipeline is just xml under the hood it shouldn’t need to be compiled. |
|
Orchestrations |
Again a whole bunch of suggestions |
|
|
BAM |
Bunch of ideas |
|
|
BRE |
Bunch of suggestions |
|
|
Deployment |
Bunch of suggestions
|
|
|
Application Life Cycle |
Bunch of suggestions
|
|
|
Binding Files |
Another bunch of suggestions |
|
|
Operations |
More –> |
|
|
HAT |
|
|
|
Cross Referencing |
Bunch of suggestions |
|
Sharepoint and ASP.Net MVC
Codeplex has another interesting project where the owner tried to combine ASP.Net MVC with Sharepoint technology.Sharepoint MVCis a helper project used to host ASP.Net MVC in Sharepoint 2007.
Eventhough ASP.Net MVC can be hosted from any asp.net website, it was interesting to note that developers tried hosting it inside Sharepoint. Currently, sharepoint does not support ASP.Net […]
Next UK SOA/BPM User Group Meeting – 26th May 2009, London
The next UK SOA/BPM User Group Meeting has been announced which will be taking place on Tuesday, 26th May 2009 at Microsoft’s London office between 6pm – 9pm.
The meeting will include a presentation by ISV Ascentn who will provide an overview of the current SOA & BPM product offerings; the developer session is currently open […]
BizTalk PowerShell Scripts
I finally put my set of PowerShell
script samples for BizTalk Server administration together into a single git repository
over at GitHub. As a reference, here are the blog
posts covering each of those scripts:
-
Controlling
BizTalk Orchestrations with PowerShell -
BizTalk
Ports with PowerShell -
BTS
Suspended Messaging Instances with PowerShell -
BTSReset
with PowerShell -
Administering
BizTalk With PowerShell: Part 1 -
Listing
BTS Adapters with PowerShell
WCF REST Screencasts/Videos
Over the past several months, I've been posting numerous screencasts on the WCF 3.5 REST programming model, the WCF REST Starter Kit (both Preview 1 and Preview 2), and their various features. I thought it might be helpful to provide readers with a consolidated index at this point:
WCF 3.5 REST Screencasts
- Building RESTful Services with WCF – Part 1
- Building RESTful Services with WCF – Part 2
- Calling RESTful Services with WCF
WCF REST Starter Kit Preview 1 Screencasts
- Getting started with the WCF REST Starter Kit (Preview 1)
- A lap around the new API extensions – Part 1
- A lap around the new API extensions – Part 2
- Resource singleton services
- Resource collection services
- Atom feed services
- AtomPub services
- HTTP plain XML (POX) services
- Multiple resource representations
- Implementing X-HTTP-Method-Override
WCF REST Starter Kit Preview 2 Screencasts
- Getting started with the WCF REST Starter Kit (Preview 2)
- Using HttpClient to consume Twitter in under 3 minutes!
- Consuming REST services with HttpClient
- HttpClient: Query string and form input
- HttpClient: Processing message content
Screencast: Processing message content with HttpClient
I recently published a new screencast video on Processing message content with HttpClient. Check out this post for more background.
This screencast shows you how to process different types of messages that you might get back from RESTful services on the Web. It shows how to use XLinq, DataContractSerializer, and XmlSerializer, and it shows how to process XML, Atom, and JSON messages.
Check out our growing collection of free .NET screencasts and videos. You can subscribe to the Pluralsight feed to be notified when new screencasts are published. In addition, check out our growing library of Pluralsight On-Demand! training courses.
A myriad of messaging processing options with HttpClient
The HttpClient class provides support for invoking the HTTP uniform interface (Get, Post, Put, Delete, Head, etc). And it provides support for processing messages using a variety of different representations. This is made possible through the HttpResponseMessage and HttpContent classes, which provides numerous methods for reading the message body as different representations. Here's a list of the possibilities:
- ReadAsByteArray
- ReadAsDataContract
- ReadAsJsonDataContract
- ReadAsServiceDocument
- ReadAsStream
- ReadAsString
- ReadAsSyndicationFeed
- ReadAsXElement
- ReadAsXmlReader
- ReadAsXmlSerializable
And many of these methods have generic version that allow you to specify a serializable type. You'll need to ensure that you have the appropriate namespace using statement within the file or some of these extension methods may not show up in intellisense.
And between HttpContent and HttpContentExtensions, you also have a similar set of methods for creating request messages from a variety of different formats:
- Create(Byte[])
- Create(Stream)
- Create(String)
- Create (XElement)
- CreateAtom10SyndicationFeed
- CreateDataContract
- CreateJsonDataContract
- CreateRss20SyndicationFeed
- CreateXmlSerializable
Check out this screencast for a complete example that shows how to use some of the methods listed above.
Screencast: HttpClient and query string/form input
I recently published a new screencast video on HttpClient: query string and form input. Check out this post for more background on these features and a brief code example.
This screencast shows you how to manage query string and form input required by RESTful services on the Web by using some of the new features in the WCF REST Starter Kit Preview 2. The example shows how to send this type of input into the Twitter REST API.
Check out our growing collection of free .NET screencasts and videos. You can subscribe to the Pluralsight feed to be notified when new screencasts are published. In addition, check out our growing library of Pluralsight On-Demand! training courses.