Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 31d3b20

Browse files
committed
Added MatrixPatternResolver Class.
1 parent 20b647c commit 31d3b20

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.mathworks.ci;
2+
/*
3+
* Copyright 2019 The MathWorks, Inc.
4+
*
5+
* This is Matrix pattern resolver class which is a utility for identifying variables. Either $xyz, ${xyz} or ${a.b} but not $a.b, while ignoring "$$"
6+
*/
7+
8+
import java.util.regex.Matcher;
9+
import java.util.regex.Pattern;
10+
11+
public class MatrixPatternResolver {
12+
private String inputString;
13+
private static Pattern VARIBLE = Pattern.compile("\\$([A-Za-z0-9_]+|\\{[A-Za-z0-9_.]+\\}|\\$)");
14+
15+
public MatrixPatternResolver(String inputString) {
16+
this.inputString = inputString;
17+
}
18+
19+
public String getInputString() {
20+
return this.inputString;
21+
}
22+
23+
public boolean hasVariablePattern() {
24+
Matcher m = VARIBLE.matcher(getInputString());
25+
return m.find(0);
26+
}
27+
}

0 commit comments

Comments
 (0)