public static AssemblyPatternBlock fromString(String str) {
		if ("[]".equals(str)) {
			return new AssemblyPatternBlock(0, new byte[0], new byte[0]);
		}
		int pos = 0;
		int offset = 0;
		// Compute the offset, byte consuming SS:
		while (str.regionMatches(pos, SHIFT_STR, 0, SHIFT_STR.length())) {
			pos += SHIFT_STR.length();
			offset++;
		}
		if (str.regionMatches(pos, SHIFT_STR_END, 0, SHIFT_STR_END.length())) {
			return new AssemblyPatternBlock(offset, new byte[0], new byte[0]);
		}

		// Compute the length by counting the colons
		int length = 1;
		for (int p = pos; p < str.length();) {
			int newpos = str.indexOf(':', p);
			if (newpos == -1) {
				break;
			}
			length++;
			p = newpos + 1;
		}

		// Convert the bytes
		// TODO: Optimize this some
		byte[] mask = new byte[length];
		byte[] vals = new byte[length];
		AtomicLong msk = new AtomicLong();
		AtomicLong val = new AtomicLong();
		int i = 0;
		for (String hex : str.substring(pos).split(":")) {
			NumericUtilities.convertHexStringToMaskedValue(msk, val, hex, 2, 0, null);
			mask[i] = (byte) msk.get();
			vals[i] = (byte) val.get();
			i++;
		}

		return new AssemblyPatternBlock(offset, mask, vals);
	}
Convert a string representation to a pattern block

@see NumericUtilities#convertHexStringToMaskedValue(AtomicLong, AtomicLong, String, int, int,
     String)
@param str the string to convert
@return the resulting pattern block
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/assembler/sleigh/sem/AssemblyPatternBlock.java