Detect string patterns with regular expressions

已完成 已发布的 Oct 13, 2014 货到付款
已完成 货到付款

I have a series of text patterns that need to be identified in a block of text. The routine will be in Javascript and will return an array identifying the patterns matching according to the specs below.

The text will have linefeeds. I need the line number, the ids, and the type of pattern matched.

Important: Any pattern containing [[...]] should be discarded. That is "[[" followed by any number of characters then "]]"

In the patterns below the identifiers are represented by aaa or bbb is an id. An id can be in the range A-Za-z0-9_ There may be more than 1 identifier in a string.

The pattern has the type specified.

Type: Participant

Length: 1 line

Expected output:

{type: 'Participant', pos: {start: y, stop: y}, ids: [aaa]}

Example:

participant aaa

Type: Message

Length: 1 line

Expected output:

{type: 'Message', pos: {start: y, stop: y}, ids: [aaa, bbb]}

Example:

aaa -> bbb

Type: MessageWithText

Length: 1 line

Expected output:

{type: 'MessageWithText', pos: {start: y, stop: y}, ids: [aaa, bbb]}

Example:

aaa -> bbb : text

Type: Reference

Length: 1 line

Expected output:

{type: 'Reference', pos: {start: y, stop: y}, ids: [aaa, bbb]}

Example:

ref over aaa, bbb

Type: ReferenceWithText

Length: 1 line

Expected output:

{type: 'ReferenceWithText', pos: {start: y, stop: y}, ids: [aaa, bbb]}

Example:

ref over aaa, bbb : text

Type: MultiLineReferenceWithText

Length: multiple lines

Expected output:

{type: 'MultiLineReferenceWithText', pos: {start: y1, stop: y2}, ids: [aaa, bbb]}

Example:

ref over aaa, bbb

multiple lines of text with no [[...]]

end

Type: MultiLineNote

Length: multiple lines

Expected output:

{type: 'MultiLineNote', pos: {start: y1, stop: y2}, ids: [aaa] }

Example:

note left of aaa {

multiple lines of text with no [[...]]

}

note right of aaa {

multiple lines of text with no [[...]]

}

Type: Class

Length: single line

Expected output:

{type: 'Class', pos: {start: y, stop: y}, ids: [aaa] }

Example:

class aaa

Type: ComplexClass

Length: multiple lines

Expected output:

{type: 'ComplexClass', pos: {start: y, stop: y}, ids: [aaa] }

Example:

class aaa {

Zero or more method strings (see below)

}

Type: Method

A method must be embedded into a ComplexClass

Length: single line

Expected output:

{type: 'Method', pos: {start: y, stop: y}, ids: [aaa] }

Example:

+ aaa()

PHP 软件构架

项目ID: #6586850

关于项目

10个方案 远程项目 活跃的Oct 14, 2014

授予:

sergioes

Hi, I have one question, do yo need this done just with regexp, or some js logic can also be used? Thanks. Sergio.

$250 USD 在10天内
(245条评论)
7.0

有10名威客正在参与此工作的竞标,均价$540/小时

rinsadsl

Hi Good Day I am quite good with pattern matching. Have done plenty of tasks in this area. I can handle your project and all the scenarios listed without an issue. Looking forward to hear from you. Thanks Rinsad

$368 USD 在3天内
(413条评论)
7.6
CodingExpertz

Hi, I looked your posting and I am very much interested to work with you ...I am an India based software professional providing a range of IT services and solutions that address the technology needs of your company in 更多

$789 USD 在10天内
(112条评论)
6.3
techwelfare

hi we could do it perfectly with accuracy, please let us know if you want to clarify in details.. if you want us to share our skill and previous work please initiate the chat by replying..

$595 USD 在10天内
(76条评论)
6.3
samitalways4u

Hello Sir, I have read your requirements and I am ready to do your projects and we are really confident that we are able to do it. Please Give me a Chance. Thank You..

$631 USD 在15天内
(29条评论)
5.7
ForeignTree

A proposal has not yet been provided

$250 USD 在4天内
(9条评论)
4.9
anshangtai

A proposal has not yet been provided

$555 USD 在10天内
(4条评论)
4.0
HDragon131

Hi Dear! I am a Expert of skills such as php, mysql, javascript and web site management. Also i have a lot of experience with these skill. I am familiar with the functions you mention in the description.I am ver 更多

$526 USD 在3天内
(9条评论)
3.9
GabrielSoare

Propunerea nu a fost încă furnizată

$966 USD 在21天内
(6条评论)
3.5
jingguo811

Hi sir. Thank you for your post. I read your description carefully. I am very interesting in your assignment. I am an expert in matlab, while a manager of website development with 3 developers. They have gained en 更多

$250 USD 在6天内
(3条评论)
2.8