Skip to content

Commit a1cedcd

Browse files
committed
[serial] Fix 4-digit serial number in input
1 parent 9f5386e commit a1cedcd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/ReadoutCard/ParameterTypes/SerialId.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class SerialId
3131
public:
3232
/// Constructs a SerialId object using a string in the sssss[:e] format
3333
/// For example: "10241", "10241:1"
34-
/// \param string String of format "^[ \t]*([0-9]{3}|[0-9]{5}):?[0-1]?[ \t]*$"
34+
/// \param string String of format "^[ \t]*([0-9]{3}|[0-9]{4}|[0-9]{5}):?[0-1]?[ \t]*$"
3535
SerialId(const std::string& string);
3636

3737
SerialId(int serial, int endpoint);
3838

3939
SerialId(int serial);
4040

41-
/// Converts to a SerialId object from a string that matches "^[ \t]*[0-9]{5}:?[0-1]?[ \t]*$"
41+
/// Converts to a SerialId object from a string that matches "^[ \t]*([0-9]{3}|[0-9]{4}|[0-9]{5}):?[0-1]?[ \t]*$"
4242
/// For example: "10241:0"
4343
static boost::optional<SerialId> fromString(std::string string);
4444

src/ParameterTypes/SerialId.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace
2727

2828
bool parseSerialIdString(const std::string string, int& serial, int& endpoint)
2929
{
30-
std::regex expression("^[ \t]*([0-9]{3}|[0-9]{5}):?[0-1]?[ \t]*$");
30+
std::regex expression("^[ \t]*([0-9]{3}|[0-9]{4}|[0-9]{5}):?[0-1]?[ \t]*$");
3131
if (std::regex_search(string, expression)) {
3232
serial = stoi(string.substr(0, string.find(':'))); // Will return the SerialId struct
3333
endpoint = stoi(string.substr(string.find(':') + 1));

0 commit comments

Comments
 (0)